godotenv
godotenv copied to clipboard
Add suport to env setted
The change looks good, has tests, seems like it would work.
I'm not too keen on merging it without understanding the purpose. Is this an implementation of #38? If so, is it reasonably complete?
I have a dynamic environment variable set outside the dotenv and replacing this variable would be interesting.
example:
# .env
SSL_CERT_FILE=${API_PATH}/config/cert/${API_HOST}.pem
SSL_KEY_FILE=${API_PATH}/config/cert/${API_HOST}.key
// Get base path application
_, filename, _, _ := runtime.Caller(0)
os.Setenv("API_PATH", path.Dir(filename)+"/..")
var err error
if currentEnvironment, ok := os.LookupEnv("ENV"); ok == true {
err = godotenv.Load(os.ExpandEnv("$API_PATH/.env." + currentEnvironment))
} else {
err = godotenv.Load(os.ExpandEnv("$API_PATH/.env"))
}
Implement of #17
Hi, what is the problem with this PR? Do you need any help?