File tree Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " wrangler " : patch
3+ ---
4+
5+ Internal-only WRANGLER_D1_EXTRA_LOCATION_CHOICES environment variable for enabling D1's testing location hints
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import dedent from "ts-dedent";
22import { fetchResult } from "../cfetch" ;
33import { formatConfigSnippet } from "../config" ;
44import { createCommand } from "../core/create-command" ;
5+ import { getD1ExtraLocationChoices } from "../environment-variables/misc-variables" ;
56import { UserError } from "../errors" ;
67import { logger } from "../logger" ;
78import { requireAuth } from "../user" ;
@@ -53,7 +54,10 @@ export const d1CreateCommand = createCommand({
5354 } ,
5455 location : {
5556 type : "string" ,
56- choices : LOCATION_CHOICES ,
57+ choices : [
58+ ...LOCATION_CHOICES ,
59+ ...( getD1ExtraLocationChoices ( ) ?. split ( "," ) ?? [ ] ) ,
60+ ] ,
5761 description : dedent `
5862 A hint for the primary location of the new DB. Options:
5963 weur: Western Europe
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ type VariableNames =
3333 | "WRANGLER_BUILD_CONDITIONS"
3434 | "WRANGLER_BUILD_PLATFORM"
3535 | "WRANGLER_REGISTRY_PATH"
36+ | "WRANGLER_D1_EXTRA_LOCATION_CHOICES"
3637 | "WRANGLER_DOCKER_BIN"
3738 | "WRANGLER_DOCKER_HOST" ;
3839
Original file line number Diff line number Diff line change @@ -248,6 +248,16 @@ export const getRegistryPath = getEnvironmentVariableFactory({
248248 } ,
249249} ) ;
250250
251+ /**
252+ * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.
253+ *
254+ * External accounts cannot access testing envionments, so should not set this variable.
255+ */
256+ export const getD1ExtraLocationChoices : ( ) => string | undefined =
257+ getEnvironmentVariableFactory ( {
258+ variableName : "WRANGLER_D1_EXTRA_LOCATION_CHOICES" ,
259+ } ) ;
260+
251261/**
252262 * `WRANGLER_DOCKER_BIN` specifies the path to a docker binary.
253263 *
Original file line number Diff line number Diff line change 4545 " WORKERS_CI" ,
4646 " WRANGLER_API_ENVIRONMENT" ,
4747 " WRANGLER_AUTH_DOMAIN" ,
48+ " WRANGLER_D1_EXTRA_LOCATION_CHOICES" ,
4849 " WRANGLER_DISABLE_EXPERIMENTAL_WARNING" ,
4950 " WRANGLER_DISABLE_REQUEST_BODY_DRAINING" ,
5051 " WRANGLER_LOG" ,
You can’t perform that action at this time.
0 commit comments