MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / assertPublicRuntimeGuard

Function assertPublicRuntimeGuard

next.config.mjs:26–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26function assertPublicRuntimeGuard() {
27 const [, , command, ...args] = process.argv;
28 const port = readCliPort(args)?.trim();
29 const isPublicStart = command === "start" && port === PUBLIC_PORT;
30 if (!isPublicStart) {
31 return;
32 }
33
34 const startedByWrapper = process.env.MC_RUNTIME_WRAPPER === "dev-server";
35 const allowedPublicRuntime =
36 process.env.MC_ALLOW_PUBLIC_RUNTIME === "1" &&
37 process.env.NODE_ENV === "production" &&
38 distDir === PUBLIC_DIST_DIR;
39
40 if (startedByWrapper || allowedPublicRuntime) {
41 return;
42 }
43
44 throw new Error(
45 `[mission-control] Refusing to start public port ${PUBLIC_PORT} without an approved Mission Control runtime. Use "node scripts/dev-server.cjs --port ${PUBLIC_PORT}" for wrapper mode, or run the production public runtime with MC_ALLOW_PUBLIC_RUNTIME=1 and NEXT_DIST_DIR=${PUBLIC_DIST_DIR} (mission-control.service does this automatically).`
46 );
47}
48
49assertPublicRuntimeGuard();
50

Callers 1

next.config.mjsFile · 0.85

Calls 1

readCliPortFunction · 0.85

Tested by

no test coverage detected