(env = process.env)
| 15 | ]); |
| 16 | |
| 17 | export function startupConfigIssues(env = process.env) { |
| 18 | const issues = []; |
| 19 | const apiKey = env.BRAIN_API_KEY; |
| 20 | |
| 21 | if (typeof apiKey !== 'string' || apiKey.trim() === '') { |
| 22 | issues.push('BRAIN_API_KEY is required. Set it in .env or environment.'); |
| 23 | } else { |
| 24 | const trimmed = apiKey.trim(); |
| 25 | if (trimmed !== apiKey) { |
| 26 | issues.push('BRAIN_API_KEY must not have leading or trailing whitespace.'); |
| 27 | } |
| 28 | if (PLACEHOLDER_API_KEYS.has(trimmed.toLowerCase())) { |
| 29 | issues.push('BRAIN_API_KEY still has a placeholder value. Generate a unique secret before starting the API.'); |
| 30 | } |
| 31 | if (trimmed.length < 16) { |
| 32 | issues.push('BRAIN_API_KEY must be at least 16 characters.'); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | return issues; |
| 37 | } |
no outgoing calls
no test coverage detected