Currently the godotenv library doesn't support loading different .env files such as .env.test for testing .env.staging for staging.
Here's the small snippet, to support different environments file dynamically. Based on the @adamcohen comment.(option 1)
https://github.com/joho/godotenv/issues/43 - Follow this issue for future changes
- Create a config struct as below
- Access the env values using the config struct
- Run the program with current ENVIRONMENT value set