diff --git a/config/runtime.exs b/config/runtime.exs index 1246515..09fc34e 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -115,6 +115,15 @@ if config_env() == :prod do # # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details. + + # Only configure the production mailer if we have AWS credentials + if System.get_env("AWS_ACCESS_KEY_ID") || System.get_env("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") do + config :absinthe_federation_example, AbsintheFederationExample.Mailer, adapter: Swoosh.Adapters.ExAwsAmazonSES + config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: AbsintheFederationExample.Finch + # Disable Swoosh Local Memory Storage + config :swoosh, local: false + end + config :libcluster, debug: true # https://dmblake.com/elixir-clustering-with-libcluster-and-aws-ecs-fargate-in-cdk @@ -179,12 +188,4 @@ if config_env() == :prod do access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role], secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role], region: System.get_env("AWS_REGION") || "us-east-1" - - # Only configure the production mailer if we have AWS credentials - if System.get_env("AWS_ACCESS_KEY_ID") || System.get_env("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") do - config :absinthe_federation_example, AbsintheFederationExample.Mailer, adapter: Swoosh.Adapters.ExAwsAmazonSES - config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: AbsintheFederationExample.Finch - # Disable Swoosh Local Memory Storage - config :swoosh, local: false - end end