First version of OpenAuth remake
This commit is contained in:
46
src/config.ts
Normal file
46
src/config.ts
Normal file
@ -0,0 +1,46 @@
|
||||
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;
|
Reference in New Issue
Block a user