Skip to content

Commit cc79dba

Browse files
committed
Add env var documentation in readme
1 parent b39fbf9 commit cc79dba

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Socket Badge](https://socket.dev/api/badge/npm/package/socket)](https://socket.dev/npm/package/socket)
44
[![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
55

6-
> CLI tool for [Socket.dev](https://socket.dev/)
6+
> CLI tool for [Socket.dev]
77
88
## Usage
99

@@ -15,11 +15,11 @@ socket --help
1515
## Commands
1616

1717
- `socket npm [args...]` and `socket npx [args...]` - Wraps `npm` and `npx` to
18-
integrate Socket and preempt installation of alerted packages using the
18+
integrate [Socket.dev] and preempt installation of alerted packages using the
1919
builtin resolution of `npm` to precisely determine package installations.
2020

2121
- `socket optimize` - Optimize dependencies with
22-
[`@socketregistry`](https://github.com/SocketDev/socket-registry) overrides!
22+
[`@socketregistry`](https://github.com/SocketDev/socket-registry) overrides
2323
_(👀 [our blog post](https://socket.dev/blog/introducing-socket-optimize))_
2424

2525
- `--pin` - Pin overrides to their latest version.
@@ -35,8 +35,7 @@ socket --help
3535
All aliases support the flags and arguments of the commands they alias.
3636

3737
- `socket ci` - alias for `socket report create --view --strict` which creates a
38-
report and quits with an exit code if the result is unhealthy. Use like eg.
39-
`socket ci .` for a report for the current folder
38+
report for the current directory and quits with an exit code if the result is unhealthy.
4039

4140
## Flags
4241

@@ -48,10 +47,10 @@ All aliases support the flags and arguments of the commands they alias.
4847

4948
### Output flags
5049

51-
- `--json` - outputs result as json which you can then pipe into
52-
[`jq`](https://stedolan.github.io/jq/) and other tools
53-
- `--markdown` - outputs result as markdown which you can then copy into an
54-
issue, PR or even chat
50+
- `--json` - Outputs result as JSON which you can then pipe into
51+
[`jq`](https://stedolan.github.io/jq/) and other tools.
52+
- `--markdown` - Outputs result as Markdown which you can then copy into an
53+
issue, PR, or chat.
5554

5655
## Strictness flags
5756

@@ -82,7 +81,22 @@ use of the `projectIgnorePaths` to excludes files when creating a report.
8281

8382
## Environment variables
8483

85-
- `SOCKET_CLI_API_TOKEN` - if set, this will be used as the API-key
84+
- `SOCKET_CLI_ACCEPT_RISKS` - Accept risks of a safe-npm and safe-npx run.
85+
- `SOCKET_CLI_API_TOKEN` - Set the Socket API token.<br>
86+
*Aliases:* `SOCKET_CLI_API_KEY`, `SOCKET_SECURITY_API_TOKEN`, and `SOCKET_SECURITY_API_KEY`<br>
87+
- `SOCKET_CLI_CONFIG` - A JSON stringified Socket configuration object.
88+
- `SOCKET_CLI_GIT_USER_EMAIL` - The git config user.email used by Socket CLI.<br>
89+
*Defaults:* `github-actions[bot]@users.noreply.github.com`<br>
90+
- `SOCKET_CLI_GIT_USER_NAME` - The git config user.name used by Socket CLI.<br>
91+
*Defaults:* `github-actions[bot]`<br>
92+
*Aliases:* `SOCKET_CLI_GIT_USERNAME`<br>
93+
- `SOCKET_CLI_GITHUB_TOKEN` - A classic [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the "repo" scope or a fine-grained access token with at least read/write permissions set for "Contents" and "Pull Request".<br>
94+
*Aliases:* `SOCKET_SECURITY_GITHUB_PAT` and `GITHUB_TOKEN`<br>
95+
- `SOCKET_CLI_NO_API_TOKEN` - Make the default API token `undefined`.
96+
- `SOCKET_CLI_NPM_PATH` - The absolute location of the npm directory.
97+
- `SOCKET_CLI_ORG_SLUG` - Specify the Socket organization slug.<br>
98+
*Aliases:* `SOCKET_ORG_SLUG`<br>
99+
- `SOCKET_CLI_VIEW_ALL_RISKS` - View all risks of a safe-npm and safe-npx run.
86100

87101
## Contributing
88102

@@ -101,21 +115,24 @@ That should invoke it from local sources. If you make changes you run
101115

102116
### Environment variables for development
103117

104-
- `SOCKET_CLI_API_BASE_URL` - if set, this will be the base for all
105-
API-calls. Defaults to `https://api.socket.dev/v0/`
106-
- `SOCKET_CLI_API_PROXY` - if set to something like
107-
[`http://127.0.0.1:9090`](https://docs.proxyman.io/troubleshooting/couldnt-see-any-requests-from-3rd-party-network-libraries),
108-
then all request will be proxied through that proxy
118+
- `DEBUG` - Enable debug logging based on the [`debug`](https://socket.dev/npm/package/debug) package.
119+
- `SOCKET_CLI_API_BASE_URL` - Change the base URL for all API-calls.<br>
120+
*Defaults:* The "apiBaseUrl" value of socket/settings local app data if present, else `https://api.socket.dev/v0/`.<br>
121+
*Aliases:* `SOCKET_SECURITY_API_BASE_URL`<br>
122+
- `SOCKET_CLI_API_PROXY` - Set the proxy that all requests are routed through.<br>
123+
For example, if set to [`http://127.0.0.1:9090`](https://docs.proxyman.io/troubleshooting/couldnt-see-any-requests-from-3rd-party-network-libraries), then all request are proxied through that proxy.<br>
124+
*Aliases:* `HTTPS_PROXY`, `https_proxy`, `HTTP_PROXY`, and `http_proxy`<br>
125+
- `SOCKET_CLI_DEBUG` - Enable debug logging in Socket CLI.<br>
126+
:bulb: Not needed if `DEBUG` is specified.
109127

110128
## Similar projects
111129

112-
- [`@socketsecurity/sdk`](https://github.com/SocketDev/socket-sdk-js) - the SDK
113-
used in this CLI
130+
- [`@socketsecurity/sdk`](https://github.com/SocketDev/socket-sdk-js) - The SDK used by Socket CLI
114131

115132
## See also
116133

117134
- [Announcement blog post](https://socket.dev/blog/announcing-socket-cli-preview)
118-
- [Socket API Reference](https://docs.socket.dev/reference) - the API used in
119-
this CLI
120-
- [Socket GitHub App](https://github.com/apps/socket-security) - the
121-
plug-and-play GitHub App
135+
- [Socket API Reference](https://docs.socket.dev/reference) - The API used by Socket CLI
136+
- [Socket GitHub App](https://github.com/apps/socket-security) - The plug-and-play GitHub App
137+
138+
[Socket.dev]: https://socket.dev/

src/constants.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ const LAZY_ENV = () => {
340340
// programs are located. When a command is run, the system searches these
341341
// directories to find the executable.
342342
PATH: envAsString(env['PATH']),
343-
// Accept risks of safe-npm and safe-npx run.
343+
// Accept risks of a safe-npm and safe-npx run.
344344
SOCKET_CLI_ACCEPT_RISKS: envAsBoolean(env[SOCKET_CLI_ACCEPT_RISKS]),
345345
// Change the base URL for all API-calls.
346346
// https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development
@@ -349,7 +349,7 @@ const LAZY_ENV = () => {
349349
envAsString(env['SOCKET_SECURITY_API_BASE_URL']) ||
350350
getConfigValueOrUndef('apiBaseUrl') ||
351351
'https://api.socket.dev/v0/',
352-
// Set the proxy all requests are routed through.
352+
// Set the proxy that all requests are routed through.
353353
// https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development
354354
SOCKET_CLI_API_PROXY:
355355
envAsString(env['SOCKET_CLI_API_PROXY']) ||
@@ -388,14 +388,14 @@ const LAZY_ENV = () => {
388388
GITHUB_TOKEN,
389389
// Make the default API token `undefined`.
390390
SOCKET_CLI_NO_API_TOKEN: envAsBoolean(env['SOCKET_CLI_NO_API_TOKEN']),
391-
// The absolute location of the npm bin file.
391+
// The absolute location of the npm directory.
392392
SOCKET_CLI_NPM_PATH: envAsString(env['SOCKET_CLI_NPM_PATH']),
393393
// Specify the Socket organization slug.
394394
SOCKET_CLI_ORG_SLUG:
395395
envAsString(env['SOCKET_CLI_ORG_SLUG']) ||
396396
// Coana CLI accepts the SOCKET_ORG_SLUG environment variable.
397397
envAsString(env['SOCKET_ORG_SLUG']),
398-
// View all risks of safe-npm and safe-npx run.
398+
// View all risks of a safe-npm and safe-npx run.
399399
SOCKET_CLI_VIEW_ALL_RISKS: envAsBoolean(env[SOCKET_CLI_VIEW_ALL_RISKS]),
400400
// Specifies the type of terminal or terminal emulator being used by the process.
401401
TERM: envAsString(env['TERM']),

0 commit comments

Comments
 (0)