fix: random type errors

This commit is contained in:
diced
2024-09-12 16:33:40 -07:00
parent bd774b8ffb
commit 96a6fe577e
4 changed files with 9 additions and 31 deletions

View File

@@ -1,13 +1,10 @@
import { PROP_TO_ENV } from '@/lib/config/read';
import { Config } from '@/lib/config/validate';
export function checkRateLimit(config: Config) {
if (config.ratelimit.max <= 0) throw new Error(`${PROP_TO_ENV['ratelimit.max']} must be greater than 0`);
if (config.ratelimit.max <= 0) throw new Error('ratelimitMax must be greater than 0');
if (config.ratelimit.window && !config.ratelimit.max)
throw new Error(
`${PROP_TO_ENV['ratelimit.max']} must be set if ${PROP_TO_ENV['ratelimit.window']} is set`,
);
throw new Error('ratelimitMax must be set if ratelimitWindow is set');
return;
}