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

Load Config From Env #155

Closed
nawaitesidah opened this issue May 29, 2018 · 3 comments
Closed

Load Config From Env #155

nawaitesidah opened this issue May 29, 2018 · 3 comments
Milestone

Comments

@nawaitesidah
Copy link
Contributor

Hello,
Is it possible to load config (host, token, email) from env var?
This is useful when using lab in a CI environment.
Or is there a way to give these values without reading from stdin?

@zaquestion
Copy link
Owner

@hadigoh I thought we had support for this, but never tried it out myself, it looks like I need add a couple more lines in main.go to make it function. I'm hoping to do a release soon and get a bunch of these relatively easy feature requests in, will include this.

  viper.SetEnvPrefix("LAB")
  viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))

@zaquestion zaquestion added this to the 0.12.0 milestone May 29, 2018
@zaquestion
Copy link
Owner

@hadigoh As a work around you can always write the lab config file and load config for that. Lab will use the config file in the current directory if present or ~/.config/lab.hcl

zaquestion added a commit that referenced this issue Jun 20, 2018
allow host, user, and token to be set with environment, implements #155
@zaquestion
Copy link
Owner

This is now supported in 0.12.0 with LAB_ prefix and underscores in place of . for nested keys. e.g. LAB_CORE_HOST

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

2 participants