Skip to content

Commit

Permalink
changing env variables casing (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak Sharma authored Mar 5, 2021
1 parent 386ad14 commit 2ed183e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
6 changes: 3 additions & 3 deletions cmd/analyse.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ func destructor(cmd *cobra.Command, args []string) {

//runAnalyse is controller func for analyses cmd.
func runAnalyse(cmd *cobra.Command, args []string) {
if !viper.IsSet("crda-key") {
if !viper.IsSet("crda_key") {
fmt.Fprintln(os.Stdout,
color.RedString("\u2718 "),
"Please run `crda auth` command first.",
)
os.Exit(1)
}
requestParams := driver.RequestType{
UserID: viper.GetString("crda-key"),
ThreeScaleToken: viper.GetString("auth-token"),
UserID: viper.GetString("crda_key"),
ThreeScaleToken: viper.GetString("auth_token"),
Host: viper.GetString("host"),
RawManifestFile: args[0],
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type promtVars struct {
var authCmd = &cobra.Command{
Use: "auth",
Short: "Links uuid with Snyk token.",
Long: fmt.Sprintf(`Command maps Snyk Token with UUID and Outputs 'crda-key' for further Authentication.
Long: fmt.Sprintf(`Command maps Snyk Token with UUID and Outputs 'crda_key' for further Authentication.
To get "Snyk Token" Please click here: %s`, snykURL),
Run: main,
Expand All @@ -48,21 +48,21 @@ func main(cmd *cobra.Command, args []string) {
snykToken = promptForToken()
}
requestParams := auth.RequestServerType{
UserID: viper.GetString("crda-key"),
UserID: viper.GetString("crda_key"),
SynkToken: snykToken,
ThreeScaleToken: viper.GetString("auth-token"),
ThreeScaleToken: viper.GetString("auth_token"),
Host: viper.GetString("host"),
}
userID := auth.RequestServer(requestParams)

fmt.Fprint(os.Stdout, "Successfully Registered. \n\n")
green := color.New(color.FgHiGreen, color.Bold).SprintFunc()
fmt.Fprint(os.Stdout,
fmt.Sprintf(green("crda-key: ")+"%s\n\n", color.GreenString(userID)),
fmt.Sprintf(green("crda_key: ")+"%s\n\n", color.GreenString(userID)),
)
fmt.Fprint(os.Stdout, "This key is confidential, Please keep it safe!. \n")

viper.Set("crda-key", userID)
viper.Set("crda_key", userID)
viper.WriteConfig()
log.Debug().Msgf("Successfully Executed Auth command.")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func initConfig() {
if !viper.IsSet("host") {
viper.Set("host", constants.Host)
}
if !viper.IsSet("auth-token") {
viper.Set("auth-token", constants.AuthToken)
if !viper.IsSet("auth_token") {
viper.Set("auth_token", constants.AuthToken)
}
viper.WriteConfig()
log.Debug().Msgf("Using config file %s.\n", viper.ConfigFileUsed())
Expand Down
7 changes: 2 additions & 5 deletions docs/cli_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ Executable supports following commands:

- `crda auth`: This command is used to enable user to Authenticate with CRDA Server. This command generates and saves Auth Token in `$HOME/.crda/config.yaml`
Supported Flags:
* `--synk-token` (string) (OPTIONAL): Can be obtained from [here](https://app.snyk.io/login?utm_campaign=Code-Ready-Analytics-2020&utm_source=code_ready&code_ready=FF1B53D9-57BE-4613-96D7-1D06066C38C9). If not set, Freemium a/c with limited functionality will be created.
* `--auth-token` (string) (OPTIONAL): 3Scale Gateway Authentication token. Needed if you wish to access Auth APIs hosted at plateform other than CRDA.
* `--config` (string) (OPTIONAL): Absolute Path to config file.
* `--host` (string) (OPTIONAL): Server URL, For Auth API's hosted at Plateform other than CRDA
* `--show-token` (bool) (OPTIONAL): If you wish to view new auth token generated. Please note, New Token generated is confidential and is mapped to your Synk Account. Keep it safe!
* `--synk_token` (string) (OPTIONAL): Can be obtained from [here](https://app.snyk.io/login?utm_campaign=Code-Ready-Analytics-2020&utm_source=code_ready&code_ready=FF1B53D9-57BE-4613-96D7-1D06066C38C9). If not set, Freemium a/c with limited functionality will be created.
Please note, New Token generated is confidential and is mapped to your Synk Account. Keep it safe!

- `crda analyse`: Command to perform Full Stack Analyses.
Supported Flags:
Expand Down

0 comments on commit 2ed183e

Please sign in to comment.