elixir-toniq / vapor

Runtime configuration system for Elixir
MIT License
596 stars 37 forks source link

How to deal with dependencies that rely on System environment variables? #102

Open Francesco-Lanciana opened 4 years ago

Francesco-Lanciana commented 4 years ago

I'm currently using the Goth library which on start relies on a system environment variable having been set. From my understanding mix is responsible for starting dependencies before the main application starts, which is where we use Vapor to load in environment variables.

Is there any way to deal with this situation nicely? i.e. use vapor to load environment variables before the application is started? I'm also curious to know, in general should library authors not be using System.get_env? Is this more a case of a poorly thought out library or is it just a limitation of Vapor?

mhanberg commented 3 years ago

I'm not sure there is a way.

In your case, according to the readme, Goth allows you to a config module with an init callback, which should work with vapor.