Skip to content

Commit

Permalink
fix envs from conf not being set
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrie30 committed Aug 4, 2019
1 parent 16ed2f6 commit 563906b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Fixed
### Security

## [1.1.6] - 08/03/19
### Added
### Changed
### Deprecated
### Removed
### Fixed
- setting all envs from conf
### Security

## [1.1.5] - 08/03/19
### Added
- Tests for configs
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ var versionCmd = &cobra.Command{
Short: "Print the version number of Ghorg",
Long: `All software has versions. This is Ghorg's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v1.1.5")
fmt.Println("v1.1.6")
},
}
6 changes: 6 additions & 0 deletions configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func initConfig() {
getOrSetDefaults("GHORG_CLONE_TYPE")
getOrSetDefaults("GHORG_SCM_TYPE")
getOrSetDefaults("GHORG_GITLAB_DEFAULT_NAMESPACE")
// Optionally set
getOrSetDefaults("GHORG_GITHUB_TOKEN")
getOrSetDefaults("GHORG_GITLAB_TOKEN")
getOrSetDefaults("GHORG_BITBUCKET_USERNAME")
getOrSetDefaults("GHORG_BITBUCKET_APP_PASSWORD")
}

// Load triggers the configs to load first, not sure if this is actually needed
Expand All @@ -87,6 +92,7 @@ func isZero(value interface{}) bool {

func getOrSetDefaults(envVar string) {

// When a user does not set value in $HOME/ghorg/conf.yaml set the default values, else set env to what they have added to the file.
if viper.GetString(envVar) == "" {
switch envVar {
case "GHORG_ABSOLUTE_PATH_TO_CLONE_TO":
Expand Down

0 comments on commit 563906b

Please sign in to comment.