()
| 24 | const __dirname = path.dirname(__filename); |
| 25 | |
| 26 | function findConfig(): string { |
| 27 | if (process.env.A3S_CONFIG) return process.env.A3S_CONFIG; |
| 28 | // Try configs directory first (for testing) |
| 29 | const configsDir = path.join(__dirname, '..', 'configs', 'test_config.acl'); |
| 30 | if (fs.existsSync(configsDir)) return configsDir; |
| 31 | // Then try standard locations |
| 32 | const homeConfig = path.join(os.homedir(), '.a3s', 'config.acl'); |
| 33 | if (fs.existsSync(homeConfig)) return homeConfig; |
| 34 | let p = path.resolve(__dirname); |
| 35 | for (let i = 0; i < 10; i++) { |
| 36 | const c = path.join(p, '.a3s', 'config.acl'); |
| 37 | if (fs.existsSync(c)) return c; |
| 38 | const parent = path.dirname(p); |
| 39 | if (parent === p) break; |
| 40 | p = parent; |
| 41 | } |
| 42 | throw new Error('Config not found. Create configs/test_config.acl, ~/.a3s/config.acl, or set A3S_CONFIG'); |
| 43 | } |
| 44 | |
| 45 | function hasRealProviderConfig(configPath: string): boolean { |
| 46 | if (process.env.A3S_CONFIG) return true; |
no test coverage detected