Skip to content

Commit 0fc182b

Browse files
use remoteBindings instead of localBindingsOnly
1 parent ba50b6a commit 0fc182b

File tree

12 files changed

+34
-35
lines changed

12 files changed

+34
-35
lines changed

.changeset/modern-foxes-dream.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"wrangler": minor
33
---
44

5-
add a `localBindingsOnly` option to `getPlatformProxy` to disable the remote aspect of remote bindings
5+
add a `remoteBindings` option to `getPlatformProxy` to allow the disabling of remote bindings

.changeset/tangy-steaks-boil.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"wrangler": minor
33
---
44

5-
Add `localBindingsOnly` option to `startWorker` to disable remote bindings
5+
Add a `remoteBindings` option to `startWorker` to disable remote bindings

fixtures/get-platform-proxy-remote-bindings/tests/local-bindings-only.test.ts renamed to fixtures/get-platform-proxy-remote-bindings/tests/remote-bindings-false.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { getPlatformProxy } from "wrangler";
33
import type { Ai } from "@cloudflare/workers-types/experimental";
44

55
describe(
6-
"getPlatformProxy - remote bindings with localBindingsOnly",
6+
"getPlatformProxy - remote bindings with remoteBindings: false",
77
{ timeout: 50_000 },
88
() => {
99
test("getPlatformProxy works with remote bindings", async () => {
1010
const { env, dispose } = await getPlatformProxy<{
1111
AI: Ai;
1212
}>({
13-
configPath: "./wrangler.local-bindings-only.jsonc",
14-
localBindingsOnly: true,
13+
configPath: "./wrangler.remote-bindings-false.jsonc",
14+
remoteBindings: false,
1515
});
1616

1717
await expect(

packages/wrangler/e2e/remote-binding/start-worker-remote-bindings.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)("startWorker - remote bindings", () => {
125125
});
126126
});
127127

128-
it("doesn't connect to remote bindings when `localBindingsOnly` is set", async () => {
128+
it("doesn't connect to remote bindings when `remoteBindings` is set to `false`", async () => {
129129
const helper = new WranglerE2ETestHelper();
130130
await helper.seed(resolve(__dirname, "./workers"));
131131
await helper.seed({
@@ -147,7 +147,7 @@ it("doesn't connect to remote bindings when `localBindingsOnly` is set", async (
147147
dev: {
148148
inspector: false,
149149
server: { port: 0 },
150-
localBindingsOnly: true,
150+
remoteBindings: false,
151151
},
152152
});
153153

packages/wrangler/src/api/integrations/platform/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ export type GetPlatformProxyOptions = {
8686
*/
8787
persist?: boolean | { path: string };
8888
/**
89-
* Wether only local bindings should be used. This effectively disables the remote aspect of remote bindings
90-
* (exactly as if their `remote` configuration was changed from `true` to `false`)
89+
* Wether remote bindings should be enabled or not (defaults to `true`)
9190
*/
92-
localBindingsOnly?: boolean;
91+
remoteBindings?: boolean;
9392
};
9493

9594
/**
@@ -143,7 +142,7 @@ export async function getPlatformProxy<
143142
});
144143

145144
let remoteProxySession: RemoteProxySession | undefined = undefined;
146-
if (config.configPath && !options.localBindingsOnly) {
145+
if (config.configPath && !options.remoteBindings) {
147146
remoteProxySession = (
148147
(await maybeStartOrUpdateRemoteProxySession({
149148
path: config.configPath,

packages/wrangler/src/api/startDevWorker/ConfigController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async function resolveDevConfig(
126126
return {
127127
auth,
128128
remote: input.dev?.remote,
129-
localBindingsOnly: input.dev?.localBindingsOnly,
129+
remoteBindings: input.dev?.remoteBindings ?? true,
130130
server: {
131131
hostname: input.dev?.server?.hostname || config.dev.ip,
132132
port:
@@ -219,7 +219,7 @@ async function resolveBindings(
219219
{
220220
registry,
221221
local: !input.dev?.remote,
222-
localBindingsOnly: !!input.dev?.localBindingsOnly,
222+
remoteBindingsDisabled: input.dev?.remoteBindings === false,
223223
name: config.name,
224224
}
225225
);

packages/wrangler/src/api/startDevWorker/LocalRuntimeController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class LocalRuntimeController extends RuntimeController {
202202
const configBundle = await convertToConfigBundle(data);
203203

204204
if (
205-
!data.config.dev.localBindingsOnly &&
205+
data.config.dev.remoteBindings !== false &&
206206
data.config.dev?.remote !== false
207207
) {
208208
// note: remote bindings use (transitively) LocalRuntimeController, so we need to import

packages/wrangler/src/api/startDevWorker/MultiworkerRuntimeController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class MultiworkerRuntimeController extends LocalRuntimeController {
113113
const configBundle = await convertToConfigBundle(data);
114114

115115
if (
116-
!data.config.dev.localBindingsOnly &&
116+
data.config.dev.remoteBindings !== false &&
117117
data.config.dev?.remote !== false
118118
) {
119119
// note: remote bindings use (transitively) LocalRuntimeController, so we need to import

packages/wrangler/src/api/startDevWorker/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ export interface StartDevWorkerInput {
166166
* - undefined (default): Run your Worker's code locally, and any configured remote bindings remotely
167167
*/
168168
remote?: boolean | "minimal";
169-
/** Whether only local bindings (no remote ones) should be used during local development */
170-
localBindingsOnly?: boolean;
169+
/** Whether remote bindings should be enabled */
170+
remoteBindings?: boolean;
171171
/** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
172172
auth?: AsyncHook<CfAccount, [Pick<Config, "account_id">]>; // provide config.account_id as a hook param
173173
/** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */

0 commit comments

Comments
 (0)