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.
Hi,
Our regular Ecto repo is configured like this (it fetches credentials from AWS based on some configured role):
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! 🙇🏼