Do envconfig-loading in config.go (and test it!) [#9]

This commit is contained in:
Erin Call
2019-12-23 14:44:59 -08:00
parent ef4db923cd
commit c4c136b021
3 changed files with 60 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package helm
import ()
import (
"github.com/kelseyhightower/envconfig"
)
// The Config struct captures the `settings` and `environment` blocks in the application's drone
// config. Configuration in drone's `settings` block arrives as uppercase env vars matching the
@@ -33,3 +35,8 @@ type Config struct {
Release string `` // Release argument to use in applicable helm commands
Force bool `` // Pass --force to applicable helm commands
}
// Populate reads environment variables into the Config.
func (cfg *Config) Populate() error {
return envconfig.Process("plugin", cfg)
}