Skip to content

Commit 83280a2

Browse files
committed
fix contributor mode isolation
1 parent 1c1bc9f commit 83280a2

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

scripts/dev-runner.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
8282
devInstance: "inherited-instance",
8383
synaraHome: "/tmp/inherited-home",
8484
authToken: "inherited-secret",
85+
host: "0.0.0.0",
8586
port: 3773,
8687
devUrl: new URL("http://localhost:5733"),
8788
});
@@ -91,6 +92,7 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
9192
devInstance: undefined,
9293
synaraHome: "./.forkara/contributor",
9394
authToken: undefined,
95+
host: undefined,
9496
port: undefined,
9597
devUrl: undefined,
9698
});
@@ -104,6 +106,7 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
104106
devInstance: "existing",
105107
synaraHome: "/tmp/existing-home",
106108
authToken: "existing-secret",
109+
host: "192.168.1.50",
107110
port: 4222,
108111
devUrl,
109112
});
@@ -113,6 +116,7 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
113116
devInstance: "existing",
114117
synaraHome: "/tmp/existing-home",
115118
authToken: "existing-secret",
119+
host: "192.168.1.50",
116120
port: 4222,
117121
devUrl,
118122
});
@@ -122,7 +126,12 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
122126
Effect.gen(function* () {
123127
const env = yield* createDevRunnerEnv({
124128
mode: "dev:contributor",
125-
baseEnv: { SYNARA_AUTH_TOKEN: "inherited-secret" },
129+
baseEnv: {
130+
SYNARA_AUTH_TOKEN: "inherited-secret",
131+
SYNARA_HOST: "0.0.0.0",
132+
SYNARA_PUBLIC_URL: "https://forkara.example.com",
133+
SYNARA_ALLOW_INSECURE_REMOTE: "1",
134+
},
126135
serverOffset: 3158,
127136
webOffset: 3158,
128137
synaraHome: "./.forkara/contributor",
@@ -139,6 +148,9 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
139148
assert.equal(env.SYNARA_PORT, "6931");
140149
assert.equal(env.PORT, "8891");
141150
assert.equal(env.SYNARA_AUTH_TOKEN, undefined);
151+
assert.equal(env.SYNARA_HOST, "127.0.0.1");
152+
assert.equal(env.SYNARA_PUBLIC_URL, undefined);
153+
assert.equal(env.SYNARA_ALLOW_INSECURE_REMOTE, undefined);
142154
assert.equal(env.SYNARA_MODE, "web");
143155
}),
144156
);

scripts/dev-runner.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ export function createDevRunnerEnv({
250250
delete output.SYNARA_DESKTOP_WS_URL;
251251
}
252252

253+
if (mode === "dev:contributor") {
254+
delete output.SYNARA_PUBLIC_URL;
255+
delete output.SYNARA_ALLOW_INSECURE_REMOTE;
256+
}
257+
253258
if (mode === "dev:server" || mode === "dev:web") {
254259
output.SYNARA_MODE = "web";
255260
delete output.SYNARA_DESKTOP_WS_URL;
@@ -411,6 +416,7 @@ interface DevRunnerPresetInput {
411416
readonly devInstance: string | undefined;
412417
readonly synaraHome: string | undefined;
413418
readonly authToken: string | undefined;
419+
readonly host: string | undefined;
414420
readonly port: number | undefined;
415421
readonly devUrl: URL | undefined;
416422
}
@@ -424,6 +430,7 @@ export function applyDevRunnerPreset(
424430
devInstance: input.devInstance,
425431
synaraHome: input.synaraHome,
426432
authToken: input.authToken,
433+
host: input.host,
427434
port: input.port,
428435
devUrl: input.devUrl,
429436
};
@@ -434,6 +441,7 @@ export function applyDevRunnerPreset(
434441
devInstance: undefined,
435442
synaraHome: CONTRIBUTOR_HOME,
436443
authToken: undefined,
444+
host: undefined,
437445
port: undefined,
438446
devUrl: undefined,
439447
};
@@ -479,6 +487,7 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
479487
...configuredOffset,
480488
synaraHome: input.synaraHome,
481489
authToken: input.authToken,
490+
host: input.host,
482491
port: input.port,
483492
devUrl: input.devUrl,
484493
});
@@ -516,7 +525,7 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
516525
noBrowser: booleanOverrides.noBrowser,
517526
autoBootstrapProjectFromCwd: booleanOverrides.autoBootstrapProjectFromCwd,
518527
logWebSocketEvents: booleanOverrides.logWebSocketEvents,
519-
host: input.host,
528+
host: preset.host,
520529
port: preset.port,
521530
devUrl: preset.devUrl,
522531
});

0 commit comments

Comments
 (0)