(settings: Settings)
| 391 | } |
| 392 | |
| 393 | export const validateSettings = (settings: Settings): ValidationIssue[] => { |
| 394 | const issues: ValidationIssue[] = [] |
| 395 | |
| 396 | if (!settings.info?.relay_url) { |
| 397 | issues.push({ path: 'info.relay_url', message: 'relay_url is required' }) |
| 398 | } |
| 399 | |
| 400 | if (!settings.info?.name) { |
| 401 | issues.push({ path: 'info.name', message: 'name is required' }) |
| 402 | } |
| 403 | |
| 404 | if (!settings.network) { |
| 405 | issues.push({ path: 'network', message: 'network section is required' }) |
| 406 | } |
| 407 | |
| 408 | if (settings.payments?.enabled && !settings.payments.processor) { |
| 409 | issues.push({ path: 'payments.processor', message: 'processor is required when payments are enabled' }) |
| 410 | } |
| 411 | |
| 412 | const strategy = settings.limits?.rateLimiter?.strategy |
| 413 | if (strategy && strategy !== 'ewma' && strategy !== 'sliding_window') { |
| 414 | issues.push({ path: 'limits.rateLimiter.strategy', message: 'strategy must be ewma or sliding_window' }) |
| 415 | } |
| 416 | |
| 417 | validateShape(loadDefaults(), settings, [], issues) |
| 418 | |
| 419 | return issues |
| 420 | } |
no test coverage detected