()
| 57 | * Priority: --config flag > ./dbhub.toml |
| 58 | */ |
| 59 | export function resolveTomlConfigPath(): string | null { |
| 60 | const args = parseCommandLineArgs(); |
| 61 | |
| 62 | // 1. Check for --config flag (highest priority) |
| 63 | if (args.config) { |
| 64 | const configPath = expandHomeDir(args.config); |
| 65 | if (!fs.existsSync(configPath)) { |
| 66 | throw new Error( |
| 67 | `Configuration file specified by --config flag not found: ${configPath}` |
| 68 | ); |
| 69 | } |
| 70 | return configPath; |
| 71 | } |
| 72 | |
| 73 | // 2. Check for dbhub.toml in current directory |
| 74 | const defaultConfigPath = path.join(process.cwd(), "dbhub.toml"); |
| 75 | if (fs.existsSync(defaultConfigPath)) { |
| 76 | return defaultConfigPath; |
| 77 | } |
| 78 | |
| 79 | return null; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Validate the structure of the parsed TOML configuration |
no test coverage detected