diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index c10dc9c..c3a7930 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -1,6 +1,6 @@ import type { Command } from 'commander'; import type { Config } from '../config/index.js'; -import { getConfigPath, getDataDir, formatStatus } from './shared.js'; +import { getConfigPath, getDataDir, formatStatus, resolveOverlayPath } from './shared.js'; import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs'; import { resolve, join } from 'path'; import { parse } from 'yaml'; @@ -27,6 +27,18 @@ const checkConfigExists: Check = async (ctx) => { return { status: 'fail', label: 'Config file exists', detail: `not found at ${ctx.configPath}` }; }; +const checkOverlayExists: Check = async (ctx) => { + const overlayPath = resolveOverlayPath(ctx.configPath); + if (!overlayPath) { + return { status: 'skip', label: 'Config overlay', detail: '(FLYNN_ENV not set)' }; + } + const env = process.env.FLYNN_ENV; + if (existsSync(overlayPath)) { + return { status: 'pass', label: 'Config overlay', detail: `(${env}.yaml found)` }; + } + return { status: 'fail', label: 'Config overlay', detail: `FLYNN_ENV=${env} but ${overlayPath} not found` }; +}; + const checkConfigParses: Check = async (ctx) => { if (!existsSync(ctx.configPath)) { return { status: 'skip', label: 'Config parses', detail: '(no config file)' }; @@ -203,6 +215,7 @@ const checkTailscale: Check = async (ctx) => { const allChecks: Check[] = [ checkConfigExists, + checkOverlayExists, checkConfigParses, checkConfigValidates, checkEnvVars,