Skip to content

Add suport to env setted#53

Open
afranioce wants to merge 1 commit into
joho:mainfrom
afranioce:master
Open

Add suport to env setted#53
afranioce wants to merge 1 commit into
joho:mainfrom
afranioce:master

Conversation

@afranioce

Copy link
Copy Markdown

No description provided.

@joho

joho commented Mar 13, 2018

Copy link
Copy Markdown
Owner

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
Copy Markdown
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
Copy Markdown
Author

Implement of #17

@arsoba

arsoba commented Feb 25, 2019

Copy link
Copy Markdown

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