Skip to content

Commit

Permalink
fix: only read SNYK_ prefixed env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
j-luong committed Oct 16, 2024
1 parent ec5721b commit 57601c3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cliv2/cmd/cliv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func initApplicationConfiguration(config configuration.Configuration) {
config.AddAlternativeKeys(configuration.ORGANIZATION, []string{"snyk_cfg_org"})
config.AddAlternativeKeys(configuration.PREVIEW_FEATURES_ENABLED, []string{"snyk_preview"})
config.AddAlternativeKeys(configuration.LOG_LEVEL, []string{debug_level_flag})

// we'll also need to explicitly add support for these environment variables
config.SetSupportedEnvVarPrefixes("snyk_", "internal_", "test_")
config.SetSupportedEnvVars("NODE_EXTRA_CA_CERTS", "disable-analytics", "disable_analytics", "endpoint", "api")
}

func getFullCommandString(cmd *cobra.Command) string {
Expand Down
2 changes: 1 addition & 1 deletion cliv2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/snyk/cli-extension-sbom v0.0.0-20240820111700-68258cba52c7
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb
github.com/snyk/go-application-framework v0.0.0-20241011135148-71eca49aa231
github.com/snyk/go-application-framework v0.0.0-20241016204737-72e7fd400ae3
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65
github.com/snyk/snyk-iac-capture v0.6.5
github.com/snyk/snyk-ls v0.0.0-20241009134219-56a46746f0be
Expand Down
4 changes: 2 additions & 2 deletions cliv2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7 h1:Zn5BcV76oFAb
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7/go.mod h1:38w+dcAQp9eG3P5t2eNS9eG0reut10AeJjLv5lJ5lpM=
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb h1:w9tJhpTFxWqAhLeraGsMExDjGK9x5Dwj1NRFwb+t+QE=
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb/go.mod h1:Ytttq7Pw4vOCu9NtRQaOeDU2dhBYUyNBe6kX4+nIIQ4=
github.com/snyk/go-application-framework v0.0.0-20241011135148-71eca49aa231 h1:mLiZHx8m36ySB+KZ9x1OR+VR84YJuOXv0/9zYsPkReU=
github.com/snyk/go-application-framework v0.0.0-20241011135148-71eca49aa231/go.mod h1:LeMsRM1FxIfO/8QpOs9V/dI46ie/RAQl02ulAh6aKys=
github.com/snyk/go-application-framework v0.0.0-20241016204737-72e7fd400ae3 h1:pJnx0dJmYXFGHMFtPehk8qFCNlxsPx5vm+bmXQWku6g=
github.com/snyk/go-application-framework v0.0.0-20241016204737-72e7fd400ae3/go.mod h1:LeMsRM1FxIfO/8QpOs9V/dI46ie/RAQl02ulAh6aKys=
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 h1:CEQuYv0Go6MEyRCD3YjLYM2u3Oxkx8GpCpFBd4rUTUk=
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65/go.mod h1:88KbbvGYlmLgee4OcQ19yr0bNpXpOr2kciOthaSzCAg=
github.com/snyk/policy-engine v0.31.3 h1:FepCg6QN/X8uvxYjF+WwB2aiBPJB+NENDgKQeI/FwLg=
Expand Down
4 changes: 2 additions & 2 deletions test/jest/acceptance/iac/capture.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('iac capture', () => {
`snyk iac capture ./iac/drift/`,
{
...process.env,
ORG: '0d9905be-7914-42c3-ada5-9c95d6fe7eb8',
SNYK_CFG_ORG: '0d9905be-7914-42c3-ada5-9c95d6fe7eb8',
SNYK_API: apiUrl,
},
);
Expand All @@ -56,7 +56,7 @@ describe('iac capture', () => {
`snyk iac capture ${statePath}`,
{
...process.env,
ORG: orgId,
SNYK_CFG_ORG: orgId,
SNYK_API: apiUrl,
},
);
Expand Down

0 comments on commit 57601c3

Please sign in to comment.