()
| 33 | } |
| 34 | |
| 35 | async function main() { |
| 36 | // Handle help flag |
| 37 | if (process.argv.includes('--help') || process.argv.includes('-h')) { |
| 38 | showHelp(); |
| 39 | process.exit(0); |
| 40 | } |
| 41 | |
| 42 | const { startServer } = await import('./server'); |
| 43 | |
| 44 | // Parse API key from CLI |
| 45 | const cliApiKey = parseApiKey(); |
| 46 | |
| 47 | // Check if we have an API key from CLI or environment |
| 48 | if (!cliApiKey && !process.env.PAYSTACK_TEST_SECRET_KEY) { |
| 49 | console.error('Error: Paystack API key required.'); |
| 50 | console.error( |
| 51 | 'Provide via --api-key argument or PAYSTACK_TEST_SECRET_KEY environment variable.', |
| 52 | ); |
| 53 | showHelp(); |
| 54 | process.exit(1); |
| 55 | } |
| 56 | |
| 57 | await startServer(cliApiKey); |
| 58 | } |
| 59 | |
| 60 | main().catch((error) => { |
| 61 | console.error('Fatal error in main():', error); |
no test coverage detected