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

set "app_root" from environment variables #23

Open
BastiPaeltz opened this issue Jun 11, 2018 · 0 comments
Open

set "app_root" from environment variables #23

BastiPaeltz opened this issue Jun 11, 2018 · 0 comments

Comments

@BastiPaeltz
Copy link

Hey,

I think it would be nice to be able to set the app_root from environment variables like this:

app_root: "$GOPATH/src/$APP_PATH"

It should be pretty easy to implement this, there just would need to be a call to os.ExpandEnv(c.AppRoot) at the end of the Load function. E.g.:

func (c *Configuration) Load(path string) error {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	err = yaml.Unmarshal(data, c)
	if err != nil {
		return err
	}

	c.AppRoot = os.ExpandEnv(c.AppRoot)

	return err
}
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

No branches or pull requests

1 participant