From 98b0ccc6c91ffe4633679046885f56637b95e839 Mon Sep 17 00:00:00 2001 From: Michal Date: Tue, 5 May 2026 22:09:24 +0100 Subject: [PATCH] feat(cli): honor BASTION_DIR env var as default for --dir bastion serve/stop default for --dir was hardcoded to /tmp/lab-bastion. Now reads BASTION_DIR from env if set, so a deployed bastion daemon can run from a persistent directory without callers having to pass --dir on every invocation. Co-Authored-By: Claude Opus 4.7 (1M context) --- bastion/src/cli/src/commands/serve.ts | 2 +- bastion/src/cli/src/commands/stop.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bastion/src/cli/src/commands/serve.ts b/bastion/src/cli/src/commands/serve.ts index a435c92..b3d905d 100644 --- a/bastion/src/cli/src/commands/serve.ts +++ b/bastion/src/cli/src/commands/serve.ts @@ -11,7 +11,7 @@ export function registerStartCommand(parent: Command): void { .command("start") .description("Start the bastion server (HTTP + dnsmasq PXE)") .option("--port ", "HTTP port", "8080") - .option("--dir ", "Bastion data directory", "/tmp/lab-bastion") + .option("--dir ", "Bastion data directory", process.env["BASTION_DIR"] ?? "/tmp/lab-bastion") .option("--domain ", "Internal domain for hostnames", "ad.itaz.eu") .option("--dhcp-mode ", "DHCP mode: proxy or full", "proxy") .option("--fedora ", "Fedora version", "43") diff --git a/bastion/src/cli/src/commands/stop.ts b/bastion/src/cli/src/commands/stop.ts index b1ed687..67ed6d3 100644 --- a/bastion/src/cli/src/commands/stop.ts +++ b/bastion/src/cli/src/commands/stop.ts @@ -8,7 +8,7 @@ export function registerStopCommand(parent: Command): void { parent .command("stop") .description("Stop a running bastion server") - .option("--dir ", "Bastion data directory", "/tmp/lab-bastion") + .option("--dir ", "Bastion data directory", process.env["BASTION_DIR"] ?? "/tmp/lab-bastion") .action((opts: { dir: string }) => { const pidFile = `${opts.dir}/bastion.pid`;