Closed PragTob closed 5 years ago
Hey @PragTob, yeah that's not supported. If you want to have dynamic configuration, you can use:
config :rollbax,
config_callback: {MyModule, :my_function}
and read the env variables in MyModule.my_function
. Does that work for you?
@PragTob in case it helps (since I implemented it recently for a client), typically this will give something along the lines of:
# https://hexdocs.pm/rollbax/Rollbax.html#module-runtime-configuration
defmodule MyApp.Rollbax.RuntimeConfig do
def config(c) do
# keys taken from https://hexdocs.pm/rollbax/Rollbax.html#module-configuration
c
|> Keyword.put(:access_token, System.get_env("ROLLBAR_ACCESS_TOKEN"))
# NOTE: `System.get_env/2` requires Elixir 1.9.0+
|> Keyword.put(:enabled, (System.get_env("ROLLBAR_ENABLED", "0") == "1")
|> Keyword.put(:environment, System.get_env("ROLLBAR_ENV"))
end
end
Then later:
config :rollbax,
config_callback: {MyApp.Rollbax.RuntimeConfig, :config}
Happy error tracking :smile:
@whatyouhide @thbar thanks a lot :tada:
Yeah that works. I also realized that I misread the distillery docs and "${ENV}" is supported (it seemed like that was "outdated" in the docs, but I'll open another issue there about it). so it worked for me either way.
This is flexible enough of a way to work with this and quite clever, thank you! I might send a PR to add it to the README as it seems at least I didn't find it and people should find it more easily :tada:
Thanks again!
:wave:
First of all, thanks a lot for open sourcing this and enabling everyone to use rollbar with elixir :tada: :clap: :pray:
Trying to integrate it, I noticed that the following configuration didn't work:
(we wanted to have the secret only on the production host not the build host)
and resulted in:
I'm rather used to it working though :D Although, probably because we don't have any of the more advanced distillery configuration solutions set up.
Would you be open to a PR implementing {m, f, a} environment access or alternatively am I missing an easier way to do this?
Thanks and cheers! Tobi
edit: I just realized that the distillery docs might have confused me and that
${VAR}
still works but I'm not 100% sure :) Question still stands regardless :)