mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-21 12:48:28 +00:00
api: remove env aliasing
This commit is contained in:
parent
5567463636
commit
950bbb1a64
@ -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];
|
|
||||||
}
|
|
||||||
}
|
|
@ -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(
|
||||||
|
@ -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";
|
||||||
|
Loading…
Reference in New Issue
Block a user