api/cobalt: update api url error message
This commit is contained in:
parent
9d68247523
commit
16c5450d40
1 changed files with 6 additions and 8 deletions
|
@ -2,26 +2,24 @@ import "dotenv/config";
|
||||||
|
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
import path from 'path';
|
import path from "path";
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
import { env } from "./config.js"
|
import { env } from "./config.js"
|
||||||
import { Bright, Green, Red } from "./misc/console-text.js";
|
import { Red } from "./misc/console-text.js";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename).slice(0, -4);
|
const __dirname = path.dirname(__filename).slice(0, -4);
|
||||||
|
|
||||||
app.disable('x-powered-by');
|
app.disable("x-powered-by");
|
||||||
|
|
||||||
if (env.apiURL) {
|
if (env.apiURL) {
|
||||||
const { runAPI } = await import('./core/api.js');
|
const { runAPI } = await import("./core/api.js");
|
||||||
runAPI(express, app, __dirname)
|
runAPI(express, app, __dirname)
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
Red(`cobalt wasn't configured yet or configuration is invalid.\n`)
|
Red("API_URL env variable is missing, cobalt api can't start.")
|
||||||
+ Bright(`please run the setup script to fix this: `)
|
|
||||||
+ Green(`npm run setup`)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue