Is that wildcard substitution something I do manually w/ String.replace or interpolation, or is there something built-in to the config function that I am unaware of?
So far the only thing I got to work was: # .env
DATABASE_URL=postgres://postgres:postgres@db:5432/my_app_ # dev.exs
database_url = "#{System.get_env("DATABASE_URL")}#{Mix.env()}"
Software engineer. Currently working with TypeScript, Ruby and Terraform to build digital solutions! Enthusiast about Elixir, OTP, design patterns and best practices.
That Mix.env() is one way to achieve that. Personally I would still use String.replace/3, since Elixir 1.9 introduced a new way to configure your application without Mix dependency in your config-files.
Is that wildcard substitution something I do manually w/ String.replace or interpolation, or is there something built-in to the config function that I am unaware of?
So far the only thing I got to work was:
# .env
DATABASE_URL=postgres://postgres:postgres@db:5432/my_app_
# dev.exs
database_url = "#{System.get_env("DATABASE_URL")}#{Mix.env()}"
That
Mix.env()
is one way to achieve that. Personally I would still useString.replace/3
, since Elixir 1.9 introduced a new way to configure your application without Mix dependency in your config-files.I would do it this way:
test.exs
.env