History

selfhost: read the local-network posture from env in the plugins seam

plugins() runs per request; loadConfig() does filesystem work (data dir, secret key resolution) that should not ride the request path. The env read is the same computation loadConfig makes for the flag.

Rhys Sullivan committed 4 months ago

Commit 210857d1 parent 8d308e41 file · +4 −1Browse files

Unified · Split

apps/host-selfhost/src/execution.ts+4−1
@@ -44,7 +44,10 @@ export const SelfHostPluginsProvider: Layer.Layer<PluginsProvider> = Layer.succe · 43 unmodified lines
44 executorConfig.plugins({44 executorConfig.plugins({
45 activeToolkitSlug:45 activeToolkitSlug:
46 context?.mcpResource?.kind === "toolkit" ? context.mcpResource.slug : undefined,46 context?.mcpResource?.kind === "toolkit" ? context.mcpResource.slug : undefined,
47 allowLocalNetwork: loadConfig().allowLocalNetwork,47 // Read the env directly (same computation as loadConfig().allowLocalNetwork):
48 // plugins() runs per request, and loadConfig does filesystem work
49 // (data dir, secret key) that must not ride the request path.
50 allowLocalNetwork: process.env.EXECUTOR_ALLOW_LOCAL_NETWORK === "true",
48 }),51 }),
49 },52 },
50);53);