Skip to content

Commit 279a71d

Browse files
author
Devin Pastoor
committed
fix: adjust bindenv to work on keys separately
1 parent df3b42f commit 279a71d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
// VERSION is the current pkgr version
31-
var VERSION = "2.0.0"
31+
var VERSION = "2.0.1"
3232

3333
var fs afero.Fs
3434
var cfg configlib.PkgrConfig

configlib/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ func loadConfigFromPath(configFilename string) error {
122122
configFilename = "pkgr.yml"
123123
}
124124
viper.SetEnvPrefix("pkgr")
125-
viper.BindEnv("rpath", "library")
125+
err := viper.BindEnv("rpath")
126+
if err != nil {
127+
log.Fatalf("error binding env: %s\n", err)
128+
}
129+
err = viper.BindEnv("library")
130+
if err != nil {
131+
log.Fatalf("error binding env: %s\n", err)
132+
}
126133
configFilename, _ = homedir.Expand(filepath.Clean(configFilename))
127134
viper.SetConfigFile(configFilename)
128135
b, err := ioutil.ReadFile(configFilename)

configlib/structs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ type PkgrConfig struct {
4848
NoRecommended bool `yaml:"NoRecommended",omitempty"`
4949
Repos []map[string]string `yaml:"Repos,omitempty"`
5050
Rollback bool `yaml:"Rollback,omitempty"`
51-
Library string `yaml:"Library,omitempty"`
51+
Library string `yaml:"Library,omitempty" mapstructure:"library,omitempty"`
5252
LibPaths []string `yaml:"LibPaths,omitempty"`
5353
Customizations Customizations `yaml:"Customizations,omitempty"`
5454
Threads int `yaml:"Threads,omitempty"`
55-
RPath string `yaml:"RPath,omitempty"`
55+
RPath string `yaml:"RPath,omitempty" mapstructure:"rpath,omitempty"`
5656
Cache string `yaml:"Cache,omitempty"`
5757
Logging LogConfig `yaml:"Logging,omitempty"`
5858
Update bool `yaml:"Update,omitempty"`

0 commit comments

Comments
 (0)