Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions cmd/ocm-backplane/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ func NewConfigCmd() *cobra.Command {
The location of the configuration file is gleaned from ~/.config/backplane/config.json or the 'BACKPLANE_CONFIG' environment variable if set.

The following variables are supported:
url Backplane API URL
proxy-url Squid proxy URL
session-dir Backplane CLI session directory
pd-key PagerDuty API User Key
govcloud Set to true if used in FedRAMP
url Backplane API URL
proxy-url Squid proxy URL
session-dir Backplane CLI session directory
pd-key PagerDuty API User Key
jira-token JIRA token
jira-email JIRA email
govcloud Set to true if used in FedRAMP
`,
SilenceUsage: true,
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/ocm-backplane/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func setConfig(cmd *cobra.Command, args []string) error {
}
bpConfig.SessionDirectory = viper.GetString("session-dir")
bpConfig.JiraToken = viper.GetString(config.JiraTokenViperKey)
bpConfig.JiraEmail = viper.GetString(config.JiraEmailViperKey)
}

// create config directory if it doesn't exist
Expand Down Expand Up @@ -100,13 +101,15 @@ func setConfig(cmd *cobra.Command, args []string) error {
bpConfig.PagerDutyAPIKey = args[1]
case config.JiraTokenViperKey:
bpConfig.JiraToken = args[1]
case config.JiraEmailViperKey:
bpConfig.JiraEmail = args[1]
case GovcloudVar:
bpConfig.Govcloud, err = strconv.ParseBool(args[1])
if err != nil {
return fmt.Errorf("invalid value for %s: %v", GovcloudVar, err)
}
default:
return fmt.Errorf("supported config variables are %s, %s, %s, %s, %s & %s", URLConfigVar, ProxyURLConfigVar, SessionConfigVar, PagerDutyAPIConfigVar, config.JiraTokenViperKey, GovcloudVar)
return fmt.Errorf("supported config variables are %s, %s, %s, %s, %s, %s & %s", URLConfigVar, ProxyURLConfigVar, SessionConfigVar, PagerDutyAPIConfigVar, config.JiraTokenViperKey, config.JiraEmailViperKey, GovcloudVar)
}

viper.SetConfigType("json")
Expand All @@ -115,6 +118,7 @@ func setConfig(cmd *cobra.Command, args []string) error {
viper.Set(SessionConfigVar, bpConfig.SessionDirectory)
viper.Set(PagerDutyAPIConfigVar, bpConfig.PagerDutyAPIKey)
viper.Set(config.JiraTokenViperKey, bpConfig.JiraToken)
viper.Set(config.JiraEmailViperKey, bpConfig.JiraEmail)
Comment thread
Tof1973 marked this conversation as resolved.
viper.Set(GovcloudVar, bpConfig.Govcloud)

err = viper.WriteConfigAs(configPath)
Expand Down