Spaces:
Sleeping

teamta / src /config /APIKeys.ts
lamsaoganh's picture
Upload 62 files
1305386 verified
Raw History Blame Contribute Delete
1.18 kB
/**
* ๐Ÿ” API KEYS CONFIGURATION
*
* Centralized API keys management from environment variables.
* All API keys should be stored in .env file and loaded via this module.
*
* NEVER hard-code API keys in source code!
*/
/**
* Validate that all required API keys are present
* Should be called at application startup
*/
export function validateAPIKeys(): { valid: boolean; missing: string[] } {
const missing: string[] = [];
return {
valid: missing.length === 0,
missing
};
}
/**
* Throw error if API keys are missing (strict mode)
* Use this in production to fail-fast
*/
export function requireAPIKeys(): void {
const validation = validateAPIKeys();
if (!validation.valid) {
console.error('โŒ MISSING REQUIRED API KEYS:');
validation.missing.forEach(key => {
console.error(` - ${key}`);
});
console.error('\n๐Ÿ’ก Add these keys to your .env file');
console.error(' See .env.example for reference\n');
throw new Error(`Missing required API keys: ${validation.missing.join(', ')}`);
}
console.log('โœ… All required API keys are configured');
}