Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When called from distillery as a provider, config isn't actually merged an instead is overrwritten for any app in the TOML config. #26

Open
idyll opened this issue May 23, 2020 · 2 comments · May be fixed by #27

Comments

@idyll
Copy link

idyll commented May 23, 2020

When called from distillery as a provider, config isn't actually merged and instead is overrwritten for any app in the TOML config.

It's unclear to me if we should be solving this here or at the Distillery level, however other config providers appear to solve it internally...

The issue is that persist tries to merge the incoming config, but with Distillery the incoming config is always empty.

    defp persist(config, keyword) when is_list(keyword) do
      config = Config.Reader.merge(config, keyword)
      Application.put_all_env(config, persistent: true)
      config
    end

In persist config is always [] when called from Distillery because load is called as:

    if is_distillery_env?() do
      # When running under Distillery, init performs load
      load([], opts)
      opts
    else

Because of this we end up with any existing config being overwritten on an application level.

@idyll
Copy link
Author

idyll commented May 23, 2020

@idyll
Copy link
Author

idyll commented May 23, 2020

A quick temp fix (also on that branch) is to revert to not use the Config API for persist. Not sure if this is best long term...

@idyll idyll linked a pull request May 23, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant