Fix some stiff
Some checks failed
CI / build (push) Has been cancelled

This commit is contained in:
Fabian Stamm
2023-11-29 01:17:19 +01:00
parent 9234efab2a
commit 36304b8873
7 changed files with 32 additions and 36 deletions

1
Backend/.dockerignore Normal file
View File

@ -0,0 +1 @@
config.ini

View File

@ -10,6 +10,8 @@ dotenv.config();
export interface DatabaseConfig {
host: string;
database: string;
username?: string;
password?: string;
}
export interface WebConfig {
@ -57,6 +59,14 @@ const config = (parse(
type: String,
default: "localhost",
},
username: {
type: String,
optional: true,
},
password: {
type: String,
optional: true,
},
},
web: {
port: {

View File

@ -7,7 +7,16 @@ if (Config.database) {
if (Config.database.host) host = Config.database.host;
}
if (Config.core.dev) dbname += "_dev";
const DB = new SafeMongo("mongodb://" + host, dbname, {
let auth = undefined;
if (Config.database.username) {
auth = {
username: Config.database.username,
password: Config.database.password
}
}
const DB = new SafeMongo("mongodb://" + host, dbname, {
auth
});
export default DB;