Fix database connection.

This commit is contained in:
2020-09-26 20:56:28 +02:00
parent 8a4463cbc5
commit e7bf5039a5
4 changed files with 8 additions and 6 deletions

View File

@@ -3,10 +3,12 @@ const configuration = require('../configuration');
const mongoConfig = configuration.mongodb;
function buildDatabaseUrl() {
const username = mongoConfig.username;
const username = encodeURIComponent(mongoConfig.username);
const password = encodeURIComponent(mongoConfig.password);
const url = `${mongoConfig.url}:${mongoConfig.port}`;
const test = `mongodb://${username}:${password}@${url}`;
const url = mongoConfig.url;
const port = mongoConfig.port;
const database = mongoConfig.database;
const test = `mongodb://${username}:${password}@${url}:${port}/${database}`;
console.log(test);
return test;
}

View File

@@ -2,7 +2,7 @@ mongodb:
url: 'localhost'
port: 27017
username: 'application_user'
password: 'Password1'
password: 'P@ssword1'
database: 'db_application'
security:
jwt: