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

Add suport to env setted #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add suport to env setted #53

wants to merge 1 commit into from

Conversation

afranioce
Copy link

No description provided.

@joho
Copy link
Owner

joho commented Mar 13, 2018

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?

@afranioce
Copy link
Author

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"))
}

@afranioce
Copy link
Author

Implement of #17

@arsoba
Copy link

arsoba commented Feb 25, 2019

Hi, what is the problem with this PR? Do you need any help?

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 this pull request may close these issues.

3 participants