api: remove env aliasing

This commit is contained in:
dumbmoron 2024-03-10 17:21:33 +00:00
parent 5567463636
commit 950bbb1a64
No known key found for this signature in database
3 changed files with 1 additions and 26 deletions

View File

@ -1,23 +0,0 @@
import { Red } from "./consoleText.js";
const mapping = {
apiPort: 'API_PORT',
apiURL: 'API_URL',
apiName: 'API_NAME',
cors: 'CORS_WILDCARD',
cookiePath: 'COOKIE_PATH',
webPort: 'WEB_PORT',
webURL: 'WEB_URL',
showSponsors: 'SHOW_SPONSORS',
isBeta: 'IS_BETA'
}
for (const [ oldEnv, newEnv ] of Object.entries(mapping)) {
if (process.env[oldEnv] && !process.env[newEnv]) {
process.env[newEnv] = process.env[oldEnv];
console.error(`${Red('[!]')} ${oldEnv} is deprecated and will be removed in a future version.`);
console.error(` You should use ${newEnv} instead.`);
console.error();
delete process.env[oldEnv];
}
}

View File

@ -1,5 +1,4 @@
import "dotenv/config"; import "dotenv/config";
import "./modules/util/alias-envs.js";
import express from "express"; import express from "express";
@ -20,7 +19,7 @@ const __dirname = path.dirname(__filename).slice(0, -4);
app.disable('x-powered-by'); app.disable('x-powered-by');
if (process.env.API_URL) { if (process.env.API_URL && !process.env.WEB_URL) {
runAPI(express, app, gitCommit, gitBranch, __dirname) runAPI(express, app, gitCommit, gitBranch, __dirname)
} else { } else {
console.log( console.log(

View File

@ -1,5 +1,4 @@
import "dotenv/config"; import "dotenv/config";
import "../modules/sub/alias-envs.js";
import { getJSON } from "../modules/api.js"; import { getJSON } from "../modules/api.js";
import { services } from "../modules/config.js"; import { services } from "../modules/config.js";