api: move service disabling to DISABLED_SERVICES env

This commit is contained in:
wukko
2024-08-23 00:16:26 +06:00
parent ee375a27cd
commit 7a557a97c3
4 changed files with 23 additions and 26 deletions

View File

@@ -1,5 +1,14 @@
import { services } from "./processing/service-config.js";
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
const disabledServices = process.env.DISABLED_SERVICES?.split(',') || [];
const enabledServices = new Set(Object.keys(services).filter(e => {
if (!disabledServices.includes(e)) {
return e;
}
}));
const env = {
apiURL: process.env.API_URL || '',
apiPort: process.env.API_PORT || 9000,
@@ -27,6 +36,8 @@ const env = {
turnstileSecret: process.env.TURNSTILE_SECRET,
jwtSecret: process.env.JWT_SECRET,
jwtLifetime: process.env.JWT_EXPIRY || 120,
enabledServices,
}
export {