rename config
All checks were successful
Code quality checks / biome (push) Successful in 8s

This commit is contained in:
creations 2025-06-02 20:42:47 -04:00
parent 1b7948e074
commit 69f0c3d8e9
Signed by: creations
GPG key ID: 8F553AA4320FC711
4 changed files with 4 additions and 4 deletions

28
config/index.ts Normal file
View file

@ -0,0 +1,28 @@
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"),
};
function verifyRequiredVariables(): void {
const requiredVariables = ["HOST", "PORT"];
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 };