Skip to content

Commit aa7a68e

Browse files
committed
Use more env var snapshots
1 parent 2d4418f commit aa7a68e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/utils/sdk.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,26 @@ import { getConfigValue } from './config'
1212
import { AuthError } from './errors'
1313
import constants from '../constants'
1414

15-
const { SOCKET_CLI_NO_API_TOKEN, SOCKET_SECURITY_API_TOKEN } = constants
15+
const {
16+
SOCKET_CLI_NO_API_TOKEN,
17+
SOCKET_SECURITY_API_BASE_URL,
18+
SOCKET_SECURITY_API_PROXY,
19+
SOCKET_SECURITY_API_TOKEN
20+
} = constants
1621

1722
// The API server that should be used for operations.
1823
function getDefaultApiBaseUrl(): string | undefined {
1924
const baseUrl =
20-
process.env['SOCKET_SECURITY_API_BASE_URL'] || getConfigValue('apiBaseUrl')
25+
// Lazily access constants.ENV[SOCKET_SECURITY_API_BASE_URL].
26+
constants.ENV[SOCKET_SECURITY_API_BASE_URL] || getConfigValue('apiBaseUrl')
2127
return isNonEmptyString(baseUrl) ? baseUrl : undefined
2228
}
2329

2430
// The API server that should be used for operations.
2531
function getDefaultHttpProxy(): string | undefined {
2632
const apiProxy =
27-
process.env['SOCKET_SECURITY_API_PROXY'] || getConfigValue('apiProxy')
33+
// Lazily access constants.ENV[SOCKET_SECURITY_API_PROXY].
34+
constants.ENV[SOCKET_SECURITY_API_PROXY] || getConfigValue('apiProxy')
2835
return isNonEmptyString(apiProxy) ? apiProxy : undefined
2936
}
3037

0 commit comments

Comments
 (0)