Skip to content

Commit

Permalink
Add functionality to use SCS repo token as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAlvo1 committed Dec 5, 2024
1 parent f407a06 commit d219926
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/commands/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,10 @@ func addSCSScan(cmd *cobra.Command, resubmitConfig []wrappers.Config, hasEnterpr
SCSMapConfig := make(map[string]interface{})
SCSMapConfig[resultsMapType] = commonParams.MicroEnginesType // scs is still microengines in the scans API
userScanTypes, _ := cmd.Flags().GetString(commonParams.ScanTypes)
scsRepoToken, _ := cmd.Flags().GetString(commonParams.SCSRepoTokenFlag)
scsRepoToken := viper.GetString(commonParams.ScsRepoTokenKey)
if token, _ := cmd.Flags().GetString(commonParams.SCSRepoTokenFlag); token != "" {
scsRepoToken = token
}
viper.Set(commonParams.SCSRepoTokenFlag, scsRepoToken) // sanitizeLogs uses viper to get the value
scsRepoURL, _ := cmd.Flags().GetString(commonParams.SCSRepoURLFlag)
viper.Set(commonParams.SCSRepoURLFlag, scsRepoURL) // sanitizeLogs uses viper to get the value
Expand Down
1 change: 1 addition & 0 deletions internal/params/binds.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ var EnvVarsBinds = []struct {
{AiProxyAzureAiRouteKey, AiProxyAzureAiRouteEnv, "api/ai-proxy/redirect/externalAzure"},
{AiProxyCheckmarxAiRouteKey, AiProxyCheckmarxAiRouteEnv, "api/ai-proxy/redirect/azure"},
{ASCAPortKey, ASCAPortEnv, ""},
{ScsRepoTokenKey, ScsRepoTokenEnv, ""},
}
1 change: 1 addition & 0 deletions internal/params/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ const (
AiProxyAzureAiRouteEnv = "CX_AIPROXY_AZUREAI_ROUTE"
AiProxyCheckmarxAiRouteEnv = "CX_AIPROXY_CHECKMARXAI_ROUTE"
ASCAPortEnv = "CX_ASCA_PORT"
ScsRepoTokenEnv = "SCS_REPO_TOKEN"
)
1 change: 1 addition & 0 deletions internal/params/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ var (
AiProxyAzureAiRouteKey = strings.ToLower(AiProxyAzureAiRouteEnv)
AiProxyCheckmarxAiRouteKey = strings.ToLower(AiProxyCheckmarxAiRouteEnv)
ASCAPortKey = strings.ToLower(ASCAPortEnv)
ScsRepoTokenKey = strings.ToLower(ScsRepoTokenEnv)
)

0 comments on commit d219926

Please sign in to comment.