This commit is contained in:
@ -7,64 +7,68 @@ import * as ini from "ini";
|
||||
dotenv.config();
|
||||
|
||||
export interface DatabaseConfig {
|
||||
host: string
|
||||
database: string
|
||||
host: string;
|
||||
database: string;
|
||||
}
|
||||
|
||||
export interface WebConfig {
|
||||
port: string
|
||||
secure: "true" | "false" | undefined
|
||||
port: string;
|
||||
secure: "true" | "false" | undefined;
|
||||
}
|
||||
|
||||
export interface CoreConfig {
|
||||
name: string
|
||||
url: string
|
||||
dev: boolean
|
||||
name: string;
|
||||
url: string;
|
||||
dev: boolean;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
core: CoreConfig
|
||||
database: DatabaseConfig
|
||||
web: WebConfig
|
||||
core: CoreConfig;
|
||||
database: DatabaseConfig;
|
||||
web: WebConfig;
|
||||
}
|
||||
|
||||
const config = parse({
|
||||
core: {
|
||||
dev: {
|
||||
default: false,
|
||||
type: Boolean
|
||||
const config = (parse(
|
||||
{
|
||||
core: {
|
||||
dev: {
|
||||
default: false,
|
||||
type: Boolean,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: "Open Auth",
|
||||
},
|
||||
url: String,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: "Open Auth"
|
||||
},
|
||||
url: String
|
||||
},
|
||||
database: {
|
||||
database: {
|
||||
type: String,
|
||||
default: "openauth"
|
||||
database: {
|
||||
type: String,
|
||||
default: "openauth",
|
||||
},
|
||||
host: {
|
||||
type: String,
|
||||
default: "localhost",
|
||||
},
|
||||
},
|
||||
web: {
|
||||
port: {
|
||||
type: Number,
|
||||
default: 3004,
|
||||
},
|
||||
secure: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
host: {
|
||||
type: String,
|
||||
default: "localhost"
|
||||
}
|
||||
},
|
||||
web: {
|
||||
port: {
|
||||
type: Number,
|
||||
default: 3004
|
||||
},
|
||||
secure: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
}
|
||||
}, "config.ini") as any as Config;
|
||||
"config.ini"
|
||||
) as any) as Config;
|
||||
|
||||
if (process.env.DEV === "true")
|
||||
config.core.dev = true;
|
||||
if (process.env.DEV === "true") config.core.dev = true;
|
||||
if (config.core.dev)
|
||||
Logging.warning("DEV mode active. This can cause major performance issues, data loss and vulnerabilities! ")
|
||||
Logging.warning(
|
||||
"DEV mode active. This can cause major performance issues, data loss and vulnerabilities! "
|
||||
);
|
||||
|
||||
export default config;
|
||||
export default config;
|
||||
|
Reference in New Issue
Block a user