--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The new router documentation makes it a bit clearer. There is compile time and runtime configuration and it should work if you have the variables set since compile time (and read them in the config file).
On Monday, November 10, 2014, Michael Schaefermeyer <michael.sc...@gmail.com> wrote:
Hey all,--following the 12 factor app we are using environment variables for all configurations (tokens, hosts, ports, db, ...). For dev setups we rely heavily on dotenv.In our phoenix apps I am using https://github.com/avdi/dotenv_elixir. The problem is that it can't be used in (mix) configurations due to the order in which applications are being loaded (I believe). It also can't be used in the router, etc.Is there a chance to include something like dotenv in phoenix core? That would make configuring phoenix apps in the dev environment a lot easier.I'd be happy to work on this, just wanted to gauge first wether this has relevance for anyone else and a chance of making it into phoenix core.Thanks,Michael
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
José Valim
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
José Valim
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can add export
to the variables in the env file and depending on your shell load it with just $ . my.env
. Now your environment is loaded in the shell and if you have System.get_env("MY_VAR")
in your mix config it will work.
Releases are not an issue for us, as new releases always entail new containers. This new container has an isolated environment therefore configuration updates are not an issue.Maybe I misunderstood you, in which case I am sorry.
Hey Michael,
The problem I'm talking about can be illustrated like so: If your local dev machine's config.exs has some config value, say :port, set to the PORT environment variable (via System.get_env), which is 4000 locally but 80 in production, then when you build the release on your machine and deploy to production, the port will be 4000, not 80, as you expect it to be. This is because when you build the release locally, config.exs is evaluated, :port is set to 4000 as per the environment variable, and then sys.config is written with :port set to 4000. sys.config is what releases use for configuration, and can only contain terms, no function calls. This isn't apparent until you run into the issue in production.
source .env
mix phoenix.start
source .env
iex -S mix