api/config: separate error if statements for session & instance count

This commit is contained in:
wukko 2024-11-02 16:48:34 +06:00
parent 541bf04575
commit 44e08e8474
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -62,7 +62,9 @@ export const isCluster = env.instanceCount > 1;
if (env.sessionEnabled && env.jwtSecret.length < 16) { if (env.sessionEnabled && env.jwtSecret.length < 16) {
throw new Error("JWT_SECRET env is too short (must be at least 16 characters long)"); throw new Error("JWT_SECRET env is too short (must be at least 16 characters long)");
} else if (env.instanceCount > 1 && !env.redisURL) { }
if (env.instanceCount > 1 && !env.redisURL) {
throw new Error("API_REDIS_URL is required when API_INSTANCE_COUNT is >= 2"); throw new Error("API_REDIS_URL is required when API_INSTANCE_COUNT is >= 2");
} else if (env.instanceCount > 1 && !await supportsReusePort()) { } else if (env.instanceCount > 1 && !await supportsReusePort()) {
console.error('API_INSTANCE_COUNT is not supported in your environment. to use this env, your node.js'); console.error('API_INSTANCE_COUNT is not supported in your environment. to use this env, your node.js');