@@ -3,6 +3,7 @@ import fsSync from 'node:fs'
33import path from 'node:path'
44import { createRequire } from 'node:module'
55import { parseStartOptions } from '../args.js'
6+ import { buildDashboardUrl , resolveNetworkHostname } from '../network.js'
67import {
78 isProcessAlive ,
89 readFileTail ,
@@ -70,6 +71,7 @@ export async function runStart(args: string[], context: CliContext) {
7071 apiPort : options . apiPort ,
7172 uiPort : options . uiPort ,
7273 concurrency : options . concurrency ,
74+ networkAccess : options . networkAccess ,
7375 } )
7476 const workspaceDevMode = process . env . NODE_ENV === 'dev'
7577 const orchestratorStdoutPath = path . join ( dataDir , 'orchestrator.stdout.log' )
@@ -122,14 +124,20 @@ export async function runStart(args: string[], context: CliContext) {
122124 '@parallax/ui' ,
123125 'start' ,
124126 '--host' ,
125- '0.0.0.0' ,
127+ options . networkAccess ? '0.0.0.0' : '127.0.0.1 ',
126128 '--port' ,
127129 String ( options . uiPort ) ,
128130 ] ,
129131 context . rootDir ,
130- {
131- VITE_PARALLAX_API_BASE : `http://localhost:${ options . apiPort } ` ,
132- } ,
132+ options . networkAccess
133+ ? {
134+ VITE_PARALLAX_API_PORT : String ( options . apiPort ) ,
135+ PARALLAX_NETWORK_ACCESS : 'true' ,
136+ }
137+ : {
138+ VITE_PARALLAX_API_BASE : `http://localhost:${ options . apiPort } ` ,
139+ PARALLAX_NETWORK_ACCESS : 'false' ,
140+ } ,
133141 {
134142 stdoutPath : uiStdoutPath ,
135143 stderrPath : uiStderrPath ,
@@ -168,6 +176,7 @@ export async function runStart(args: string[], context: CliContext) {
168176 uiPid : uiPid || undefined ,
169177 apiPort : options . apiPort ,
170178 uiPort : options . uiPort ,
179+ networkAccess : options . networkAccess ,
171180 } ,
172181 null ,
173182 2
@@ -179,6 +188,14 @@ export async function runStart(args: string[], context: CliContext) {
179188 console . log ( `${ GREEN } ✓ Parallax started in background.${ RESET } ` )
180189 console . log ( `${ DIM } Orchestrator PID:${ RESET } ${ orchestratorPid } ` )
181190 console . log ( `${ DIM } Dashboard:${ RESET } http://localhost:${ options . uiPort } ` )
191+ if ( options . networkAccess ) {
192+ console . log (
193+ `${ DIM } Network dashboard:${ RESET } ${ buildDashboardUrl ( resolveNetworkHostname ( ) , options . uiPort ) } `
194+ )
195+ console . log (
196+ `${ YELLOW } Warning: network access is unauthenticated. Anyone on this trusted network can control Parallax and modify its configuration.${ RESET } `
197+ )
198+ }
182199 console . log ( `${ DIM } Projects:${ RESET } ${ storedConfig . projects . length } ` )
183200 console . log ( '' )
184201 console . log ( '' )
0 commit comments