Initial commit — SvelteKit fleet manager for T5 Plutonium servers
Ports push_scripts.sh (1497 lines of bash) to a SvelteKit + SQLite web app that manages a fleet of T5 Plutonium servers running on Komodo. Same push and beta workflow as the shell script, with a live SSE pipeline view, a !rt-token-gated auth modal that hard-pauses deployments on stale tokens, per-file audit diffs, and a Komodo-container deployment target. - Push/beta engines port the exact filter, held-by-beta, conflict, and stale-backup rules from the shell script - SQLite (better-sqlite3) replaces script_metadata.json; a one-shot importer moves legacy state over on first boot - 16 vitest tests cover push add/update/skip, beta open→rollback, open→promote, conflict guards, sweep frozen/manual branches, and IW4M login/status parsing - docker/ + komodo/stack.toml deploy as a managed container on the same host as the game servers, /root/zombies bind-mounted at the same path the shell script used
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { env } from 'node:process';
|
||||
|
||||
function req(name: string, fallback?: string): string {
|
||||
const v = env[name] ?? fallback;
|
||||
if (v === undefined) throw new Error(`missing env: ${name}`);
|
||||
return v;
|
||||
}
|
||||
|
||||
function num(name: string, fallback: number): number {
|
||||
const raw = env[name];
|
||||
if (!raw) return fallback;
|
||||
const n = Number(raw);
|
||||
if (!Number.isFinite(n)) throw new Error(`env ${name}=${raw} is not a number`);
|
||||
return n;
|
||||
}
|
||||
|
||||
export const config = {
|
||||
sharedScripts: req('SHARED_SCRIPTS', '/root/zombies/shared/scripts'),
|
||||
serversRoot: req('SERVERS_ROOT', '/root/zombies/t5'),
|
||||
relDest: req('REL_DEST', 'runtime/plutonium/storage/t5/raw/scripts/sp'),
|
||||
dbPath: req('DB_PATH', './data/cherry.db'),
|
||||
deployKeepDays: num('DEPLOY_KEEP_DAYS', 7),
|
||||
httpTimeoutMs: num('HTTP_TIMEOUT_MS', 10_000),
|
||||
komodo: {
|
||||
address: env.KOMODO_ADDRESS ?? '',
|
||||
apiKey: env.KOMODO_API_KEY ?? '',
|
||||
apiSecret: env.KOMODO_API_SECRET ?? ''
|
||||
},
|
||||
iw4m: {
|
||||
address: env.IW4M_ADDRESS ?? '',
|
||||
clientId: env.IW4M_CLIENT_ID ?? ''
|
||||
}
|
||||
} as const;
|
||||
|
||||
export function komodoConfigured(): boolean {
|
||||
return !!(config.komodo.address && config.komodo.apiKey && config.komodo.apiSecret);
|
||||
}
|
||||
|
||||
export function iw4mConfigured(): boolean {
|
||||
return !!(config.iw4m.address && config.iw4m.clientId);
|
||||
}
|
||||
|
||||
export const betaSrc = () => `${config.sharedScripts}/betas`;
|
||||
export const destOf = (server: string) => `${config.serversRoot}/${server}/${config.relDest}`;
|
||||
Reference in New Issue
Block a user