Skip to content

Commit

Permalink
add option to use authent for cordonbleu database
Browse files Browse the repository at this point in the history
  • Loading branch information
Gotier committed Nov 30, 2017
1 parent 840caa1 commit 54e1f37
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,20 @@ function SortByName(a, b){
// 1 semaphore par callback, donc un tableau du genre semaphore[callback] = <int>
var semaphore = [];
function getInfoCordonBleu(callback, team, dateDebutStr, dateFinStr, callbackName) {
let databaseConnectStr = "mongodb://" + applicationConf.cordonBleu.database_host + "/" + applicationConf.cordonBleu.database_name;
console.log(databaseConnectStr);

let databaseConnectStr = "";

if (applicationConf.cordonBleu.database_user != undefined && applicationConf.cordonBleu.database_user != ""
&& applicationConf.cordonBleu.database_password != undefined && applicationConf.cordonBleu.database_password != "") {
databaseConnectStr = "mongodb://" + applicationConf.cordonBleu.database_user + ":" + applicationConf.cordonBleu.database_password
+ "@" + applicationConf.cordonBleu.database_host + "/" + applicationConf.cordonBleu.database_name;
} else {
databaseConnectStr = "mongodb://" + applicationConf.cordonBleu.database_host + "/" + applicationConf.cordonBleu.database_name;
}

MongoClient.connect(databaseConnectStr, {poolSize: 10}, function(error, db) {
if (error) {
console.log(error);
console.log(error);
}

let dateDebut=new Date(dateDebutStr);
Expand Down

0 comments on commit 54e1f37

Please sign in to comment.