Skip to content

Commit

Permalink
rename env to environment as suggested in PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Apr 13, 2024
1 parent eefd9cf commit 0f63347
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .changeset/wicked-donkeys-yell.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -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<Env>({
configPath: wranglerTomlFilePath,
env: "production",
environment: "production",
});
try {
expect(env.MY_VAR).not.toBe("my-var-value");
Expand Down Expand Up @@ -263,7 +263,7 @@ describe("getPlatformProxy - env", () => {
it("should provide secrets targeting a specified environment", async () => {
const { env, dispose } = await getPlatformProxy<Env>({
configPath: wranglerTomlFilePath,
env: "production",
environment: "production",
});
try {
const { MY_DEV_VAR } = env;
Expand All @@ -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"/
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/src/api/integrations/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
*/
Expand Down Expand Up @@ -86,7 +86,7 @@ export async function getPlatformProxy<
>(
options: GetPlatformProxyOptions = {}
): Promise<PlatformProxy<Env, CfProperties>> {
const env = options.env;
const env = options.environment;

const rawConfig = readConfig(options.configPath, {
experimentalJsonConfig: options.experimentalJsonConfig,
Expand Down

0 comments on commit 0f63347

Please sign in to comment.