import { Command } from "jsr:@cliffy/command@1.0.0-rc.7"; import * as colors from "jsr:@std/fmt@0.225.2/colors"; import { AuthSetupConfig, COMPOSE_PATH, DEFAULT_AUTH_CONFIG, ENV_PATH, readEnv, SPIRE_COMPOSE_PATH, SPIRE_ENV_PATH, } from "../env.ts"; export const secretsCommand = new Command() .description("Inspect secrets status and persistence paths") .action(async () => { const loadedEnv = await readEnv(); const currentConfig: AuthSetupConfig = { ...DEFAULT_AUTH_CONFIG, ...loadedEnv, }; console.log( colors.bold( colors.blue( "\n=== Auth-Yes Secrets & Persistence Topology ===\n", ), ), ); console.log( `${ colors.cyan("Database Persistence Path:") } ${currentConfig.dbDataPath}`, ); console.log( `${ colors.cyan("SPIRE Persistence Path:") } ${currentConfig.spireDataPath}`, ); console.log( `${ colors.cyan("Local Artifact Files:") } ${ENV_PATH}, ${SPIRE_ENV_PATH}, ${COMPOSE_PATH}, ${SPIRE_COMPOSE_PATH}`, ); console.log( `${colors.cyan("PostgreSQL Password:")} ${ currentConfig.dbPassword ? colors.green( "✓ Configured (len: " + currentConfig.dbPassword.length + ")", ) : colors.red("✗ Missing") }`, ); console.log( `${colors.cyan("Application Secret:")} ${ currentConfig.appSecret ? colors.green( "✓ Configured (len: " + currentConfig.appSecret.length + ")", ) : colors.red("✗ Missing") }`, ); console.log( colors.gray( "\nTip: To dump raw environment variables, run: deno task setup dump_env\n", ), ); });