validate config.shardingMode

This commit is contained in:
Mathias Leppich 2024-09-11 18:58:39 +02:00
parent 4f758a1e9e
commit eb25f3cfe4

View file

@ -225,6 +225,11 @@ function validateConfig(file: string, config: Config) {
throw errorWithFile(file, `config.shard.current must be a positive number, not greater than config.shard.total`);
}
if ('shardingMode' in config && config.shardingMode !== undefined) {
if (typeof config.shardingMode !== 'string' || !['partition', 'round-robin', 'duration-round-robin'].includes(config.shardingMode))
throw errorWithFile(file, `config.shardingMode must be one of "partition", "round-robin" or "duration-round-robin"`);
}
if ('updateSnapshots' in config && config.updateSnapshots !== undefined) {
if (typeof config.updateSnapshots !== 'string' || !['all', 'none', 'missing'].includes(config.updateSnapshots))
throw errorWithFile(file, `config.updateSnapshots must be one of "all", "none" or "missing"`);