diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 9fe0776ce..a4ebb07e6 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1,4 +1,7 @@ import { createCli } from './cli.js' const program = createCli() +if (process.argv.length <= 2) { + process.argv.push('start') +} program.parse() diff --git a/packages/server/src/server/persisted-config.ts b/packages/server/src/server/persisted-config.ts index 98b20a2ac..cd4818a9c 100644 --- a/packages/server/src/server/persisted-config.ts +++ b/packages/server/src/server/persisted-config.ts @@ -144,6 +144,21 @@ export const PersistedConfigSchema = z export type PersistedConfig = z.infer; const CONFIG_FILENAME = "config.json"; +const DEFAULT_PERSISTED_CONFIG: PersistedConfig = PersistedConfigSchema.parse({ + version: 1, + daemon: { + listen: "127.0.0.1:6767", + cors: { + allowedOrigins: ["https://app.paseo.sh"], + }, + relay: { + enabled: true, + }, + }, + app: { + baseUrl: "https://app.paseo.sh", + }, +}); type LoggerLike = { child(bindings: Record): LoggerLike; @@ -164,18 +179,16 @@ export function loadPersistedConfig( ): PersistedConfig { const log = getLogger(logger); const configPath = getConfigPath(paseoHome); - const defaultConfig = PersistedConfigSchema.parse({}); if (!existsSync(configPath)) { try { mkdirSync(path.dirname(configPath), { recursive: true }); - writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2) + "\n"); + writeFileSync(configPath, JSON.stringify(DEFAULT_PERSISTED_CONFIG, null, 2) + "\n"); log?.info(`Initialized config file at ${configPath}`); } catch (err) { const message = err instanceof Error ? err.message : String(err); throw new Error(`[Config] Failed to initialize ${configPath}: ${message}`); } - return defaultConfig; } let raw: string;