srsViewer/config/index.ts
creations ae3224c18b
Some checks failed
Code quality checks / biome (push) Failing after 13s
first commit
2025-06-08 17:17:18 -04:00

30 lines
738 B
TypeScript

import { echo } from "@atums/echo";
const environment: Environment = {
port: Number.parseInt(process.env.PORT || "8080", 10),
host: process.env.HOST || "0.0.0.0",
development:
process.env.NODE_ENV === "development" || process.argv.includes("--dev"),
};
const srsUrl = process.env.SRS_URL;
function verifyRequiredVariables(): void {
const requiredVariables = ["HOST", "PORT", "SRS_URL"];
let hasError = false;
for (const key of requiredVariables) {
const value = process.env[key];
if (value === undefined || value.trim() === "") {
echo.error(`Missing or empty environment variable: ${key}`);
hasError = true;
}
}
if (hasError) {
process.exit(1);
}
}
export { environment, verifyRequiredVariables, srsUrl };