Reputation: 3290
In my Elixir project, I'm facing the following error and not sure where to set the runtime value to match the compile time one.
Currently the only place I define the key :app_url is in runtime.exs like this, and PHX_HOST is defined as an environment variable. :app_url is then referenced in live.ex like @app_url Application.compile_env(:myapp, :app_url)
According to the error message, this is the compile time value, and runtime value was not set.
<runtime.exs>
config :myapp,
token_signing_secret: secret_key_base,
app_url: System.get_env("PHX_HOST"),
ERROR! the application :myapp has a different value set for key :app_url during runtime compared to compile time. Since this application environment entry was marked as compile time, this difference can lead to different behaviour than expected:
* Compile time value was set to: "http://localhost:3030"
* Runtime value was not set
To fix this error, you might:
* Make the runtime value match the compile time one
* Recompile your project. If the misconfigured application is a dependency, you may need to run "mix deps.compile myapp --force"
* Alternatively, you can disable this check. If you are using releases, you can set :validate_compile_env to false in your release configuration. If you are using Mix to start your system, you can pass the --no-validate-compile-env flag
** (ErlangError) Erlang error: "aborting boot"
(elixir 1.14.1) Config.Provider.boot/2
Upvotes: 0
Views: 582
Reputation: 1
This won't work if you put the following line in runtime.exs:
config :myapp,
token_signing_secret: secret_key_base,
app_url: System.get_env("PHX_HOST"),
You have to put it in config.exs instead. At least that worked for me.
Upvotes: 0