diff --git a/.changeset/wicked-donkeys-yell.md b/.changeset/wicked-donkeys-yell.md index 86d424ebb52..2a8028f580f 100644 --- a/.changeset/wicked-donkeys-yell.md +++ b/.changeset/wicked-donkeys-yell.md @@ -4,12 +4,12 @@ feat: add support for environments in `getPlatformProxy` -allow `getPlatformProxy` to target environments by allowing users to specify an `env` option +allow `getPlatformProxy` to target environments by allowing users to specify an `environment` option Example usage: ```js const { env } = await getPlatformProxy({ - env: "production", + environment: "production", }); ``` diff --git a/fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts b/fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts index 85bfee0f88a..df7dc6f412e 100644 --- a/fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts +++ b/fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts @@ -230,7 +230,7 @@ describe("getPlatformProxy - env", () => { it("should provide bindings targeting a specified environment and also inherit top-level ones", async () => { const { env, dispose } = await getPlatformProxy({ configPath: wranglerTomlFilePath, - env: "production", + environment: "production", }); try { expect(env.MY_VAR).not.toBe("my-var-value"); @@ -263,7 +263,7 @@ describe("getPlatformProxy - env", () => { it("should provide secrets targeting a specified environment", async () => { const { env, dispose } = await getPlatformProxy({ configPath: wranglerTomlFilePath, - env: "production", + environment: "production", }); try { const { MY_DEV_VAR } = env; @@ -278,7 +278,7 @@ describe("getPlatformProxy - env", () => { await expect( getPlatformProxy({ configPath: wranglerTomlFilePath, - env: "non-existent-environment", + environment: "non-existent-environment", }) ).rejects.toThrow( /No environment found in configuration with name "non-existent-environment"/ diff --git a/packages/wrangler/src/api/integrations/platform/index.ts b/packages/wrangler/src/api/integrations/platform/index.ts index 2715236af4b..e566a6f8e8f 100644 --- a/packages/wrangler/src/api/integrations/platform/index.ts +++ b/packages/wrangler/src/api/integrations/platform/index.ts @@ -23,7 +23,7 @@ export type GetPlatformProxyOptions = { /** * The name of the environment to use */ - env?: string; + environment?: string; /** * The path to the config object to use (default `wrangler.toml`) */ @@ -86,7 +86,7 @@ export async function getPlatformProxy< >( options: GetPlatformProxyOptions = {} ): Promise> { - const env = options.env; + const env = options.environment; const rawConfig = readConfig(options.configPath, { experimentalJsonConfig: options.experimentalJsonConfig,