-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocket-cli-shadow.ts
More file actions
100 lines (94 loc) · 2.57 KB
/
socket-cli-shadow.ts
File metadata and controls
100 lines (94 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* @fileoverview Socket CLI shadow mode environment variables.
* Provides typed getters for SOCKET_CLI_SHADOW_* environment variables.
*/
import { envAsBoolean } from './helpers'
import { getEnvValue } from './rewire'
/**
* Controls Socket CLI shadow mode risk acceptance.
*
* @returns Whether to accept all risks in shadow mode
*
* @example
* ```typescript
* import { getSocketCliShadowAcceptRisks } from '@socketsecurity/lib/env/socket-cli-shadow'
*
* if (getSocketCliShadowAcceptRisks()) {
* console.log('Shadow mode risks accepted')
* }
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getSocketCliShadowAcceptRisks(): boolean {
return envAsBoolean(getEnvValue('SOCKET_CLI_SHADOW_ACCEPT_RISKS'))
}
/**
* API token for Socket CLI shadow mode.
*
* @returns Shadow mode API token or undefined
*
* @example
* ```typescript
* import { getSocketCliShadowApiToken } from '@socketsecurity/lib/env/socket-cli-shadow'
*
* const token = getSocketCliShadowApiToken()
* // e.g. 'sk_shadow_abc123...' or undefined
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getSocketCliShadowApiToken(): string | undefined {
return getEnvValue('SOCKET_CLI_SHADOW_API_TOKEN')
}
/**
* Binary path for Socket CLI shadow mode.
*
* @returns Shadow mode binary path or undefined
*
* @example
* ```typescript
* import { getSocketCliShadowBin } from '@socketsecurity/lib/env/socket-cli-shadow'
*
* const bin = getSocketCliShadowBin()
* // e.g. '/usr/local/bin/socket-shadow' or undefined
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getSocketCliShadowBin(): string | undefined {
return getEnvValue('SOCKET_CLI_SHADOW_BIN')
}
/**
* Controls Socket CLI shadow mode progress display.
*
* @returns Whether to show progress in shadow mode
*
* @example
* ```typescript
* import { getSocketCliShadowProgress } from '@socketsecurity/lib/env/socket-cli-shadow'
*
* if (getSocketCliShadowProgress()) {
* console.log('Shadow mode progress enabled')
* }
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getSocketCliShadowProgress(): boolean {
return envAsBoolean(getEnvValue('SOCKET_CLI_SHADOW_PROGRESS'))
}
/**
* Controls Socket CLI shadow mode silent operation.
*
* @returns Whether shadow mode should operate silently
*
* @example
* ```typescript
* import { getSocketCliShadowSilent } from '@socketsecurity/lib/env/socket-cli-shadow'
*
* if (getSocketCliShadowSilent()) {
* console.log('Shadow mode is silent')
* }
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getSocketCliShadowSilent(): boolean {
return envAsBoolean(getEnvValue('SOCKET_CLI_SHADOW_SILENT'))
}