Skip to content

Q: how to use mfa repo config? #292

Open
@elvanja

Description

@elvanja

Hi,

Our regular Ecto repo is configured like this (it fetches credentials from AWS based on some configured role):

# in runtime.exs
credentials = System.get_env("RDS_DB_IAM_ROLE_CREDENTIALS")

config :demo, Demo.Repo,
  configure: {Demo.Repo, :configure_with_auth_token, [credentials]}


# in repo.ex
defmodule Demo.Repo do
  use Ecto.Repo,
    otp_app: :demo,
    adapter: Ecto.Adapters.Postgres

  # Helper function to configure the connection with dynamically generated auth token for an IAM role
  def configure_with_auth_token(opts, credentials) do
    aws_credentials = :aws_credentials.get_credentials()
    # connects to AWS for token
    # rest of code omitted for brevity
    auth_token = rds_auth_token(aws_credentials)

    Keyword.put(opts, :password, auth_token)
  end
end

How can we do the same for event store?
Ideally it would be the same / similar mfa approach, but that does not work.

Thank you! 🙇🏼

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions