| 12 | const __dirname = path.dirname(__filename); |
| 13 | |
| 14 | function resolveConfigPath(): string { |
| 15 | const candidates = [ |
| 16 | process.env.A3S_CONFIG, |
| 17 | path.join(__dirname, '..', '..', '..', '..', '..', '..', '.a3s', 'config.acl'), |
| 18 | path.join(process.env.HOME || '', '.a3s', 'config.acl'), |
| 19 | ].filter(Boolean) as string[]; |
| 20 | |
| 21 | for (const candidate of candidates) { |
| 22 | if (fs.existsSync(candidate)) { |
| 23 | return candidate; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | throw new Error('Config not found. Set A3S_CONFIG or create ~/.a3s/config.acl.'); |
| 28 | } |
| 29 | |
| 30 | async function main(): Promise<void> { |
| 31 | const configPath = resolveConfigPath(); |