-
Notifications
You must be signed in to change notification settings - Fork 445
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
Profile specific environment variable #73
Comments
@theskumar Please let me know your views on it. |
Depending on your application deployment logic, you can point to different .env file during it's initialisation i.e. call to
Adding this logic is very much application dependent and varies a lot across project types, so adding this to |
@theskumar yes that is right. The only challenge in this approach is the duplication of variables which are common across different deployments. Is there a way of getting common variables from a default
We can add a new API like |
@theskumar ^^^ WDYT? |
I think you can avoid the duplication of variables with the following approach: if ENV == 'production':
load_dotenv('.env.production')
elif ENV == 'staging':
load_dotenv('.env.staging')
load_dotenv('.env') This works because, by default, You could load Does this solve your use case? I have to say though, my impression is that |
Hello, sorry for opening this. My use case is very similar. Instead of having stage, production and/or qa .env files which can be easily set using the above approaches, in my case the variables are project-based, that is, the variables are dependent on a project such as project id and secret. In other words, my application will be used for unlimited projects ( x number) as opposed to defined number (dev, qa, prod). Any suggestions. |
Can we have some more discussion on this.. my requirement is exactly like @yalegria, any suggestion would be great... |
This library is awesome and I am planning to use it in my application. I am wondering if I could suggest an enhancement which allows depoyment specific configuration variables using this library.
I am proposing to allow multiple
.env
files such as.env
: default file that contains configuration that is common across different deployment environments.env.stage
: contains configuration specific to stage deployment. For ex. URL for stage DB.env.production
: contains configuration specific to production deployment. For ex, URL for production DBThis is similar to profile specific configuration that Spring allows. Link here
What do you guys think about it. I am happy to raise a PR for it.
The text was updated successfully, but these errors were encountered: