Skip to content

Commit 82c1abc

Browse files
refactor: inline JSDoc comments for VariableNames environment variables (#10177)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
1 parent 631f26d commit 82c1abc

File tree

1 file changed

+78
-69
lines changed
  • packages/wrangler/src/environment-variables

1 file changed

+78
-69
lines changed

packages/wrangler/src/environment-variables/factory.ts

Lines changed: 78 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,105 @@ import { UserError } from "../errors";
22

33
/**
44
* Environment variables supported by Wrangler for configuration and authentication.
5-
*
6-
* ## Authentication & API Configuration
7-
*
8-
* - `CLOUDFLARE_ACCOUNT_ID` - Overrides the account ID for API requests. Can also be set in Wrangler config via `account_id` field.
9-
* - `CLOUDFLARE_API_TOKEN` - API token for authentication. Preferred over API key + email.
10-
* - `CLOUDFLARE_API_KEY` - Legacy API key for authentication. Requires CLOUDFLARE_EMAIL. It is preferred to use `CLOUDFLARE_API_TOKEN`.
11-
* - `CLOUDFLARE_EMAIL` - Email address for API key authentication. Used with `CLOUDFLARE_API_KEY`. It is preferred to use `CLOUDFLARE_API_TOKEN`.
12-
* - `CLOUDFLARE_API_BASE_URL` - Custom API base URL. Defaults to https://api.cloudflare.com/client/v4
13-
* - `CLOUDFLARE_COMPLIANCE_REGION` - Set to "fedramp_high" for FedRAMP High compliance region. This will update the API/AUTH URLs used to make requests to Cloudflare.
14-
*
15-
* ## Development & Local Testing
16-
*
17-
* - `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_*` - Local database connection strings for Hyperdrive development. The * should be replaced with the Hyperdrive binding name in the Worker.
18-
* - `NO_HYPERDRIVE_WARNING` - Suppress Hyperdrive-related warnings during development.
19-
* - `WRANGLER_HTTPS_KEY_PATH`/`WRANGLER_HTTPS_CERT_PATH` - Paths to HTTPS private key and certificate files for running the local development server in HTTP mode. Without this Wrangler will generate keys automatically.
20-
* - `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` - Load development variables from .env files (default: true).
21-
* - `CLOUDFLARE_INCLUDE_PROCESS_ENV` - Include process.env in development variables (default: false).
22-
*
23-
* ## Logging & Output
24-
*
25-
* - `WRANGLER_LOG` - Set log level: "debug", "info", "log", "warn", "error".
26-
* - `WRANGLER_LOG_PATH` - Directory for debug log files.
27-
* - `WRANGLER_LOG_SANITIZE` - Sanitize sensitive data in debug logs (default: true).
28-
* - `WRANGLER_OUTPUT_FILE_DIRECTORY` - Directory for ND-JSON output files.
29-
* - `WRANGLER_OUTPUT_FILE_PATH` - Specific path for ND-JSON output file.
30-
*
31-
* ## Build & Deployment Configuration
32-
*
33-
* - `WRANGLER_BUILD_CONDITIONS` - Comma-separated list of build conditions for esbuild.
34-
* - `WRANGLER_BUILD_PLATFORM` - Build platform for esbuild (e.g., "node", "browser").
35-
* - `WRANGLER_REGISTRY_PATH` - Path to file-based dev registry folder.
36-
* - `WRANGLER_D1_EXTRA_LOCATION_CHOICES` - Additional D1 location choices (internal use).
37-
* - `WRANGLER_DOCKER_BIN` - Path to docker binary (default: "docker").
38-
*
39-
* ## Advanced Configuration
40-
*
41-
* - `WRANGLER_API_ENVIRONMENT` - Set to "staging" to use staging APIs instead of production.
42-
* - `WRANGLER_AUTH_DOMAIN` - Custom auth domain (usually auto-configured).
43-
* - `WRANGLER_AUTH_URL` - Custom auth URL (usually auto-configured).
44-
* - `WRANGLER_CLIENT_ID` - Custom OAuth client ID (usually auto-configured).
45-
* - `WRANGLER_TOKEN_URL` - Custom token URL (usually auto-configured).
46-
* - `WRANGLER_REVOKE_URL` - Custom token revocation URL (usually auto-configured).
47-
* - `WRANGLER_CF_AUTHORIZATION_TOKEN` - Direct authorization token for API requests.
48-
* - `WRANGLER_C3_COMMAND` - Override command used by `wrangler init` (default: "create cloudflare@^2.5.0").
49-
* - `WRANGLER_SEND_METRICS` - Enable/disable telemetry data collection.
50-
*
51-
* Note: CI-specific variables (WRANGLER_CI_*, WORKERS_CI_BRANCH) are for internal use and not documented here.
52-
* Docker-related variables (WRANGLER_DOCKER_HOST, DOCKER_HOST) are also available but handled separately.
5+
* Each variable is documented with its individual JSDoc comment below.
536
*/
547
type VariableNames =
8+
// ## Authentication & API Configuration
9+
10+
/** Overrides the account ID for API requests. Can also be set in Wrangler config via `account_id` field. */
5511
| "CLOUDFLARE_ACCOUNT_ID"
56-
| "CLOUDFLARE_API_BASE_URL"
57-
| "CLOUDFLARE_API_KEY"
12+
/** API token for authentication. Preferred over API key + email. */
5813
| "CLOUDFLARE_API_TOKEN"
59-
| "CLOUDFLARE_COMPLIANCE_REGION"
14+
/** Legacy API key for authentication. Requires CLOUDFLARE_EMAIL. It is preferred to use `CLOUDFLARE_API_TOKEN`. */
15+
| "CLOUDFLARE_API_KEY"
16+
/** Email address for API key authentication. Used with `CLOUDFLARE_API_KEY`. It is preferred to use `CLOUDFLARE_API_TOKEN`. */
6017
| "CLOUDFLARE_EMAIL"
18+
/** Custom API base URL. Defaults to https://api.cloudflare.com/client/v4 */
19+
| "CLOUDFLARE_API_BASE_URL"
20+
/** Set to "fedramp_high" for FedRAMP High compliance region. This will update the API/AUTH URLs used to make requests to Cloudflare. */
21+
| "CLOUDFLARE_COMPLIANCE_REGION"
22+
23+
// ## Development & Local Testing
24+
25+
/** Local database connection strings for Hyperdrive development. The * should be replaced with the Hyperdrive binding name in the Worker. */
6126
| `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${string}`
27+
/** Suppress Hyperdrive-related warnings during development. */
6228
| "NO_HYPERDRIVE_WARNING"
63-
| "WRANGLER_API_ENVIRONMENT"
64-
| "WRANGLER_AUTH_DOMAIN"
65-
| "WRANGLER_AUTH_URL"
66-
| "WRANGLER_C3_COMMAND"
67-
| "WRANGLER_CF_AUTHORIZATION_TOKEN"
68-
| "WRANGLER_CLIENT_ID"
29+
/** Path to HTTPS private key file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */
6930
| "WRANGLER_HTTPS_KEY_PATH"
31+
/** Path to HTTPS certificate file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */
7032
| "WRANGLER_HTTPS_CERT_PATH"
33+
/** Load development variables from .env files (default: true). */
34+
| "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV"
35+
/** Include process.env in development variables (default: false). */
36+
| "CLOUDFLARE_INCLUDE_PROCESS_ENV"
37+
38+
// ## Logging & Output
39+
40+
/** Set log level: "debug", "info", "log", "warn", "error". */
7141
| "WRANGLER_LOG"
42+
/** Directory for debug log files. */
7243
| "WRANGLER_LOG_PATH"
44+
/** Sanitize sensitive data in debug logs (default: true). */
7345
| "WRANGLER_LOG_SANITIZE"
74-
| "WRANGLER_REVOKE_URL"
75-
| "WRANGLER_SEND_METRICS"
76-
| "WRANGLER_TOKEN_URL"
46+
/** Directory for ND-JSON output files. */
7747
| "WRANGLER_OUTPUT_FILE_DIRECTORY"
48+
49+
// ## Build & Deployment Configuration
50+
51+
/** Specific path for ND-JSON output file. */
7852
| "WRANGLER_OUTPUT_FILE_PATH"
53+
/** Comma-separated list of build conditions for esbuild. */
54+
| "WRANGLER_BUILD_CONDITIONS"
55+
/** Build platform for esbuild (e.g., "node", "browser"). */
56+
| "WRANGLER_BUILD_PLATFORM"
57+
/** Path to file-based dev registry folder. */
58+
| "WRANGLER_REGISTRY_PATH"
59+
/** Additional D1 location choices (internal use). */
60+
| "WRANGLER_D1_EXTRA_LOCATION_CHOICES"
61+
62+
// ## Advanced Configuration
63+
64+
/** Set to "staging" to use staging APIs instead of production. */
65+
| "WRANGLER_API_ENVIRONMENT"
66+
/** Custom auth domain (usually auto-configured). */
67+
| "WRANGLER_AUTH_DOMAIN"
68+
/** Custom auth URL (usually auto-configured). */
69+
| "WRANGLER_AUTH_URL"
70+
/** Custom OAuth client ID (usually auto-configured). */
71+
| "WRANGLER_CLIENT_ID"
72+
/** Custom token URL (usually auto-configured). */
73+
| "WRANGLER_TOKEN_URL"
74+
/** Custom token revocation URL (usually auto-configured). */
75+
| "WRANGLER_REVOKE_URL"
76+
/** Direct authorization token for API requests. */
77+
| "WRANGLER_CF_AUTHORIZATION_TOKEN"
78+
79+
// ## CI-specific Variables (Internal Use)
80+
81+
/** Override command used by `wrangler init` (default: "create cloudflare@^2.5.0"). */
82+
| "WRANGLER_C3_COMMAND"
83+
/** Enable/disable telemetry data collection. */
84+
| "WRANGLER_SEND_METRICS"
85+
/** CI branch name (internal use). */
7986
| "WORKERS_CI_BRANCH"
87+
/** CI tag matching configuration (internal use). */
8088
| "WRANGLER_CI_MATCH_TAG"
89+
/** CI override name configuration (internal use). */
8190
| "WRANGLER_CI_OVERRIDE_NAME"
91+
/** CI network mode host override (internal use). */
8292
| "WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST"
93+
/** CI preview alias generation (internal use). */
8394
| "WRANGLER_CI_GENERATE_PREVIEW_ALIAS"
84-
| "WRANGLER_BUILD_CONDITIONS"
85-
| "WRANGLER_BUILD_PLATFORM"
86-
| "WRANGLER_REGISTRY_PATH"
87-
| "WRANGLER_D1_EXTRA_LOCATION_CHOICES"
95+
96+
// ## Docker Configuration
97+
98+
/** Path to docker binary (default: "docker"). */
8899
| "WRANGLER_DOCKER_BIN"
89-
// We don't get the following using the environment variable factory,
90-
// but including here so that all environment variables are documented here:
100+
/** Docker host configuration (handled separately from environment variable factory). */
91101
| "WRANGLER_DOCKER_HOST"
92-
| "DOCKER_HOST"
93-
| "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV"
94-
| "CLOUDFLARE_INCLUDE_PROCESS_ENV";
102+
/** Docker host configuration (handled separately from environment variable factory). */
103+
| "DOCKER_HOST";
95104

96105
type DeprecatedNames =
97106
| "CF_ACCOUNT_ID"

0 commit comments

Comments
 (0)