44 lines
954 B
TypeScript
44 lines
954 B
TypeScript
export interface DatabaseConfig {
|
|
host: string
|
|
database: string
|
|
}
|
|
|
|
export interface WebConfig {
|
|
port: string
|
|
secure: "true" | "false" | undefined
|
|
}
|
|
|
|
export interface CoreConfig {
|
|
name: string
|
|
url: string
|
|
dev: string
|
|
}
|
|
|
|
export interface Config {
|
|
core: CoreConfig
|
|
database: DatabaseConfig
|
|
web: WebConfig
|
|
dev: boolean
|
|
logging: {
|
|
server: string;
|
|
appid: string;
|
|
token: string;
|
|
} | undefined
|
|
}
|
|
|
|
import * as ini from "ini";
|
|
import { readFileSync } from "fs";
|
|
|
|
import * as dotenv from "dotenv";
|
|
import { Logging } from "@hibas123/nodelogging";
|
|
dotenv.config();
|
|
|
|
const config = ini.parse(readFileSync("./config.ini").toString()) as Config;
|
|
|
|
if (config.core.dev) config.dev = Boolean(config.core.dev);
|
|
if (process.env.DEV === "true")
|
|
config.dev = true;
|
|
if (config.dev)
|
|
Logging.warning("DEV mode active. This can cause major performance issues, data loss and vulnerabilities! ")
|
|
|
|
export default config; |