Yes, I had edited for the sensitive information on it. I’m connecting to a Digital Ocean database. And unfortunately the domain is the same in the prod.exs. That’s the part which bugs me.
If you want any additional info to be provided.
This is my prods.exs
import Config
config :cidades, CidadesWeb.Endpoint, load_from_system_env: true, check_origin: false
# Do not print debug messages in production
config :logger, level: :info
# Configure your database
config :cidades, Cidades.Repo,
ssl: true,
username: "",
password: "",
database: "",
hostname: "",
port: ,
pool_size: 12,
timeout: 60_000
# Logs
config :rollbax,
environment: "prod",
enabled: true,
enable_crash_reports: true
This is my releases.exs
import Config
# Configure your endpoin
config :cidades, CidadesWeb.Endpoint,
http: [
:inet6,
port: String.to_integer(System.fetch_env!("CIDADES_PHOENIX_PORT"))
],
url: [
host: System.fetch_env!("CIDADES_K8S_PUBLIC_HOST"),
port: String.to_integer(System.fetch_env!("CIDADES_K8S_PUBLIC_PORT"))
],
secret_key_base: System.fetch_env!("CIDADES_PHOENIX_SECRET_KEY_BASE"),
cache_static_manifest: "priv/static/cache_manifest.json",
version: Application.get_env(:cidades, :version),
server: true,
root: "."
# Configure your database
# config :cidades, Cidades.Repo,
# ssl: true,
# username: System.fetch_env!("CIDADES_DO_POSTGRES_USER"),
# password: System.fetch_env!("CIDADES_DO_POSTGRES_PASSWORD"),
# database: System.fetch_env!("CIDADES_DO_POSTGRES_DB")
# hostname: System.fetch_env!("CIDADES_DO_POSTGRES_HOST"),
# port: String.to_integer(System.fetch_env!("CIDADES_DO_POSTGRES_PORT")),
# pool_size: String.to_integer(System.fetch_env!("CIDADES_DO_POSTGRES_POOL_SIZE"))
# Configures Bamboo
config :cidades, Cidades.Mailer,
adapter: Bamboo.SendGridAdapter,
api_key: System.fetch_env!("CIDADES_SENDGRID_API_KEY")
# Arc uploader
config :arc,
storage: Arc.Storage.S3,
virtual_host: true,
bucket: System.fetch_env!("CIDADES_DO_S3_BUCKET"),
asset_host: "https://#{"${CIDADES_DO_S3_HOST}"}/#{"${CIDADES_DO_S3_BUCKET}"}"
# asset_host: "https://#{System.get_env("S3_HOST")}/#{System.get_env("S3_BUCKET")}"
# AWS & S3 DO SPACES
config :ex_aws,
access_key_id: System.fetch_env!("CIDADES_DO_S3_KEY"),
secret_access_key: System.fetch_env!("CIDADES_DO_S3_SECRET"),
region: System.fetch_env!("CIDADES_DO_S3_REGION"),
s3: [
scheme: "https://",
host: System.fetch_env!("CIDADES_DO_S3_HOST"),
region: System.fetch_env!("CIDADES_DO_S3_REGION")
]
# Logs
config :rollbax,
access_token: System.fetch_env!("CIDADES_ROLLBAR_ACCESS_TOKEN")
All the environment variables are correctly being loaded in my docker container. I had tried outside docker and the same thing happen. Hard coding values works and in releases.exs throws exception: “Error tcp connect: (domain, port) non-existing domain - :nxdomain”