Files
2026-05-14 02:23:02 +03:00

32 lines
977 B
TypeScript

interface ServerConfig {
PORT: number;
HOST: string;
S3_ACCESS_KEY: string;
S3_SECRET_KEY: string;
S3_BUCKET_NAME: string;
S3_ENDPOINT_URL: string;
REMOTION_COMPOSITION_ID: string;
REDIS_URL: string;
MAX_CONCURRENT_RENDERS: number;
}
function requireEnv(key: string): string {
const value = Bun.env[key];
if (!value) {
throw new Error(`Missing required environment variable: ${key}`);
}
return value;
}
export const serverConfig: ServerConfig = {
PORT: Number(Bun.env.PORT) || 8001,
HOST: Bun.env.HOST || "0.0.0.0",
S3_ACCESS_KEY: requireEnv("S3_ACCESS_KEY"),
S3_SECRET_KEY: requireEnv("S3_SECRET_KEY"),
S3_BUCKET_NAME: requireEnv("S3_BUCKET_NAME"),
S3_ENDPOINT_URL: Bun.env.S3_ENDPOINT_URL || "http://localhost:9000",
REMOTION_COMPOSITION_ID: Bun.env.REMOTION_COMPOSITION_ID || "CaptionedVideo",
REDIS_URL: Bun.env.REDIS_URL || "redis://localhost:6379",
MAX_CONCURRENT_RENDERS: Number(Bun.env.MAX_CONCURRENT_RENDERS) || 2,
};