This commit is contained in:
sebseb7
2026-04-04 14:47:37 +02:00
commit ab25981684
18 changed files with 2271 additions and 0 deletions

28
src/config/env.js Normal file
View File

@@ -0,0 +1,28 @@
import dotenv from 'dotenv';
dotenv.config();
const REQUIRED_ENV_VARS = ['EXA_API_KEY', 'OPENROUTER_API_KEY'];
export function getConfig() {
return {
port: Number(process.env.PORT) || 3000,
host: process.env.HOST || '0.0.0.0',
exaApiKey: process.env.EXA_API_KEY,
openRouterApiKey: process.env.OPENROUTER_API_KEY,
};
}
export function validateConfig(config) {
const missing = REQUIRED_ENV_VARS.filter((name) => !process.env[name]);
if (missing.length === 0) {
return;
}
for (const name of missing) {
console.error(`Error: ${name} environment variable is not set.`);
}
process.exit(1);
}