(config)
| 436 | } |
| 437 | |
| 438 | function parseUtapiReindex(config) { |
| 439 | const { |
| 440 | enabled, |
| 441 | schedule, |
| 442 | redis, |
| 443 | bucketd, |
| 444 | onlyCountLatestWhenObjectLocked, |
| 445 | } = config; |
| 446 | assert(typeof enabled === 'boolean', |
| 447 | 'bad config: utapi.reindex.enabled must be a boolean'); |
| 448 | |
| 449 | const parsedRedis = parseRedisConfig(redis); |
| 450 | assert(Array.isArray(parsedRedis.sentinels), |
| 451 | 'bad config: utapi reindex redis config requires a list of sentinels'); |
| 452 | |
| 453 | assert(typeof bucketd === 'object', |
| 454 | 'bad config: utapi.reindex.bucketd must be an object'); |
| 455 | assert(typeof bucketd.port === 'number', |
| 456 | 'bad config: utapi.reindex.bucketd.port must be a number'); |
| 457 | assert(typeof schedule === 'string', |
| 458 | 'bad config: utapi.reindex.schedule must be a string'); |
| 459 | if (onlyCountLatestWhenObjectLocked !== undefined) { |
| 460 | assert(typeof onlyCountLatestWhenObjectLocked === 'boolean', |
| 461 | 'bad config: utapi.reindex.onlyCountLatestWhenObjectLocked must be a boolean'); |
| 462 | } |
| 463 | try { |
| 464 | cronParser.parseExpression(schedule); |
| 465 | } catch (e) { |
| 466 | assert(false, |
| 467 | 'bad config: utapi.reindex.schedule must be a valid ' + |
| 468 | `cron schedule. ${e.message}.`); |
| 469 | } |
| 470 | return { |
| 471 | enabled, |
| 472 | schedule, |
| 473 | redis: parsedRedis, |
| 474 | bucketd, |
| 475 | onlyCountLatestWhenObjectLocked, |
| 476 | }; |
| 477 | } |
| 478 | |
| 479 | function requestsConfigAssert(requestsConfig) { |
| 480 | if (requestsConfig.viaProxy !== undefined) { |
no test coverage detected