import { Command } from "jsr:@cliffy/command@1.0.0-rc.7"; import * as colors from "jsr:@std/fmt@0.225.2/colors"; import { generateDockerCompose, generateSpireDockerCompose, } from "../compose.ts"; import { AuthSetupConfig, DEFAULT_AUTH_CONFIG, generateEnv, generateSpireEnv, readEnv, } from "../env.ts"; export const dumpComposeCommand = new Command() .description("Output all generated Compose YAML configurations") .action(() => { console.log( colors.bold( colors.blue( "\n================================================================", ), ), ); console.log( colors.bold( colors.green(" STACK 1: Auth-Yes Stack (infra/compose.yml)"), ), ); console.log( colors.bold( colors.blue( "================================================================\n", ), ), ); console.log(generateDockerCompose()); console.log( colors.bold( colors.blue( "================================================================", ), ), ); console.log( colors.bold( colors.green( " STACK 2: Standalone SPIRE Stack (infra/compose.spire.yml)", ), ), ); console.log( colors.bold( colors.blue( "================================================================\n", ), ), ); console.log(generateSpireDockerCompose()); }); export const dumpEnvCommand = new Command() .description("Output current environment configuration (.env and .env.spire)") .action(async () => { const loadedEnv = await readEnv(); const currentConfig: AuthSetupConfig = { ...DEFAULT_AUTH_CONFIG, ...loadedEnv, }; console.log( colors.bold( colors.blue( "\n================================================================", ), ), ); console.log( colors.bold( colors.green(" STACK 1: Auth-Yes Environment (infra/stack.env)"), ), ); console.log( colors.bold( colors.blue( "================================================================\n", ), ), ); console.log(generateEnv(currentConfig)); console.log( colors.bold( colors.blue( "================================================================", ), ), ); console.log( colors.bold( colors.green( " STACK 2: SPIRE Stack Environment (infra/.env.spire)", ), ), ); console.log( colors.bold( colors.blue( "================================================================\n", ), ), ); console.log(generateSpireEnv(currentConfig)); });