refactor: retire old entry points, delegate to CLI
This commit is contained in:
+2
-36
@@ -1,36 +1,2 @@
|
||||
import { loadConfig } from './config/index.js';
|
||||
import { startDaemon } from './daemon/index.js';
|
||||
import { resolve } from 'path';
|
||||
import { homedir } from 'os';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
const CONFIG_PATH = process.env.FLYNN_CONFIG
|
||||
?? resolve(homedir(), '.config/flynn/config.yaml');
|
||||
|
||||
async function main() {
|
||||
console.log('Flynn starting...');
|
||||
console.log(`Loading config from: ${CONFIG_PATH}`);
|
||||
|
||||
if (!existsSync(CONFIG_PATH)) {
|
||||
console.error(`Config file not found: ${CONFIG_PATH}`);
|
||||
console.error('Copy config/default.yaml to ~/.config/flynn/config.yaml and configure it.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
const config = loadConfig(CONFIG_PATH);
|
||||
const daemon = await startDaemon(config);
|
||||
|
||||
console.log(`Allowed Telegram chat IDs: ${config.telegram.allowed_chat_ids.join(', ')}`);
|
||||
|
||||
// Keep process alive
|
||||
await new Promise<void>((resolve) => {
|
||||
daemon.lifecycle.onShutdown(async () => resolve());
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to start Flynn:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
// Legacy entry point — delegates to CLI
|
||||
import './cli/index.js';
|
||||
|
||||
Reference in New Issue
Block a user