You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1005 B
46 lines
1005 B
export interface DatabaseConfig { |
|
host: string |
|
database: string |
|
dialect: "sqlite" | "mysql" | "postgres" | "mssql" |
|
username: string |
|
password: string |
|
storage: string |
|
benchmark: "true" | "false" | undefined |
|
} |
|
|
|
export interface WebConfig { |
|
port: string |
|
secure: "true" | "false" | undefined |
|
} |
|
|
|
export interface CoreConfig { |
|
name: 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: Config = ini.parse(readFileSync("./config.ini").toString()) |
|
|
|
if (process.env.DEV === "true") { |
|
config.dev = true; |
|
Logging.warning("DEV mode active. This can cause major performance issues, data loss and vulnerabilities! ") |
|
} |
|
|
|
export default config; |