modif
This commit is contained in:
@@ -11,7 +11,7 @@ mongoose.plugin(schema => {
|
||||
|
||||
mongoose.set('debug', false);
|
||||
|
||||
const options = {
|
||||
let options = {
|
||||
// user: process.env.UDB,
|
||||
// pass: process.env.PDB,
|
||||
// useMongoClient: true,
|
||||
@@ -38,7 +38,7 @@ const options = {
|
||||
// keepAliveInitialDelay: 300000 // keepAliveInitialDelay is the number of milliseconds to wait before initiating keepAlive on the socket.
|
||||
};
|
||||
|
||||
if (process.env.AUTH_MONGODB) {
|
||||
if (process.env.AUTH_MONGODB === '1') {
|
||||
options.auth = {
|
||||
authSource: "admin",
|
||||
poolSize: 10,
|
||||
@@ -47,6 +47,12 @@ if (process.env.AUTH_MONGODB) {
|
||||
};
|
||||
}
|
||||
|
||||
if (options.auth && options.auth.user) {
|
||||
console.log('MongoDb con Authenticazione:', options.auth.user, '******');
|
||||
} else {
|
||||
console.log('### MongoDb SENZA Authenticazione !!! ');
|
||||
}
|
||||
|
||||
const db = mongoose.connection;
|
||||
|
||||
console.log('Node Version ' + process.version);
|
||||
@@ -60,7 +66,7 @@ mongoose.connect(connectionUrl, options);
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function () {
|
||||
// we're connected!
|
||||
console.log('*** CONNESSIONE EFFETTUATA ! ' + process.env.MONGODB_URI + ' db: ' + process.env.DATABASE)
|
||||
console.log('*** CONNESSIONE EFFETTUATA ! ' + connectionUrl + ' db: ' + process.env.DATABASE)
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user