2024-09-01 09:15:16 +01:00
|
|
|
import { getVersion } from "@imput/version-info";
|
2024-08-22 19:16:26 +01:00
|
|
|
import { services } from "./processing/service-config.js";
|
|
|
|
|
2024-09-01 09:15:16 +01:00
|
|
|
const version = await getVersion();
|
2024-08-03 09:47:13 +01:00
|
|
|
|
2024-08-22 19:16:26 +01:00
|
|
|
const disabledServices = process.env.DISABLED_SERVICES?.split(',') || [];
|
|
|
|
const enabledServices = new Set(Object.keys(services).filter(e => {
|
|
|
|
if (!disabledServices.includes(e)) {
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
const env = {
|
|
|
|
apiURL: process.env.API_URL || '',
|
|
|
|
apiPort: process.env.API_PORT || 9000,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
listenAddress: process.env.API_LISTEN_ADDRESS,
|
|
|
|
freebindCIDR: process.platform === 'linux' && process.env.FREEBIND_CIDR,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
corsWildcard: process.env.CORS_WILDCARD !== '0',
|
|
|
|
corsURL: process.env.CORS_URL,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
cookiePath: process.env.COOKIE_PATH,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
rateLimitWindow: (process.env.RATELIMIT_WINDOW && parseInt(process.env.RATELIMIT_WINDOW)) || 60,
|
|
|
|
rateLimitMax: (process.env.RATELIMIT_MAX && parseInt(process.env.RATELIMIT_MAX)) || 20,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
durationLimit: (process.env.DURATION_LIMIT && parseInt(process.env.DURATION_LIMIT)) || 10800,
|
|
|
|
streamLifespan: 90,
|
2024-05-16 15:57:48 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
processingPriority: process.platform !== 'win32'
|
|
|
|
&& process.env.PROCESSING_PRIORITY
|
|
|
|
&& parseInt(process.env.PROCESSING_PRIORITY),
|
2024-07-24 16:49:47 +01:00
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
externalProxy: process.env.API_EXTERNAL_PROXY,
|
2024-08-15 19:10:17 +01:00
|
|
|
|
|
|
|
turnstileSecret: process.env.TURNSTILE_SECRET,
|
2024-08-16 18:28:03 +01:00
|
|
|
jwtSecret: process.env.JWT_SECRET,
|
|
|
|
jwtLifetime: process.env.JWT_EXPIRY || 120,
|
2024-08-22 19:16:26 +01:00
|
|
|
|
|
|
|
enabledServices,
|
2024-08-03 11:33:36 +01:00
|
|
|
}
|
|
|
|
|
2024-09-01 09:15:16 +01:00
|
|
|
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 cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
|
|
|
|
|
2024-08-03 11:33:36 +01:00
|
|
|
export {
|
|
|
|
env,
|
|
|
|
genericUserAgent,
|
2024-09-01 09:15:16 +01:00
|
|
|
cobaltUserAgent,
|
2024-08-03 11:33:36 +01:00
|
|
|
}
|