From 3bfcbafc84312e5dabf3818ed8502fecd4938e55 Mon Sep 17 00:00:00 2001
From: Rosanny <rosanny.sihombing@hft-stuttgart.de>
Date: Tue, 26 May 2020 10:09:10 +0200
Subject: [PATCH] Separate development and testing configuration

---
 app.js           |  2 +-
 config/config.js | 41 +++++++++++++++++++++++++++++++++++++----
 routes/dbconn.js |  2 +-
 routes/mailer.js |  2 +-
 4 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/app.js b/app.js
index 68d3e944..3e4b3a6f 100644
--- a/app.js
+++ b/app.js
@@ -16,7 +16,7 @@ i18n.configure({
   directory: './locales'
 });
 
-var env = process.env.NODE_ENV || 'development';
+var env = process.env.NODE_ENV || 'testing';
 const config = require('./config/config')[env];
 
 var app = express();
diff --git a/config/config.js b/config/config.js
index b4c47761..201291a1 100644
--- a/config/config.js
+++ b/config/config.js
@@ -2,14 +2,48 @@ module.exports = {
   development: {
     app: {
       name: 'User Account Management',
-      port: process.env.PORT || 9989
+      port: process.env.PORT || 9989,
+      host: 'http://localhost:9989'
+    },
+    passport: {
+      strategy: 'saml',
+      saml: {
+        path: process.env.SAML_PATH || '/saml/SSO',
+        entryPoint: process.env.SAML_ENTRY_POINT || 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SSOService.php',
+        issuer: 'sp-account.m4lab.hft-stuttgart.de', //local metadata
+        logoutUrl: 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SingleLogoutService.php'
+      }
+    },
+    database: {
+      host: 'localhost',      	  // DB host
+      user: 'DBManager',          // DB username
+      password: 'Stuttgart2019',  // DB password
+      port: 3306,                 // MySQL port
+      dbUser: 'userdb',           // User DB
+      host_project: 'localhost', // DB host project db
+      dbProject: 'projectDB'     // Project DB
+    },
+    mailer: {
+      host: 'mail.hft-stuttgart.de',  // hostname
+      secureConnection: false,        // TLS requires secureConnection to be false
+      port: 587,                      // port for secure SMTP
+      authUser: 'ad\\support-transfer',
+      authPass: '6laumri2',
+      tlsCiphers: 'SSLv3',
+      from: 'support-transfer@hft-stuttgart.de',
+    }
+  },
+  testing: {
+    app: {
+      name: 'User Account Management',
+      port: process.env.PORT || 9989,
+      host: 'https://m4lab.hft-stuttgart.de/account'
     },
     passport: {
       strategy: 'saml',
       saml: {
         path: process.env.SAML_PATH || '/saml/SSO',
         entryPoint: process.env.SAML_ENTRY_POINT || 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SSOService.php',
-        //issuer: 'sp-account.m4lab.hft-stuttgart.de', //local metadata
         issuer: 'sp-account-testing.m4lab.hft-stuttgart.de', //testing metadata
         //issuer: 'sp-account-prod.m4lab.hft-stuttgart.de', //production metadata
         logoutUrl: 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SingleLogoutService.php'
@@ -22,7 +56,6 @@ module.exports = {
       port: 3306,                 // MySQL port
       dbUser: 'userdb',           // User DB
       host_project: 'm4lab.hft-stuttgart.de', // DB host project db
-      //host_project: 'localhost', // local
       dbProject: 'projectDB'     // Project DB
     },
     mailer: {
@@ -35,4 +68,4 @@ module.exports = {
       from: 'support-transfer@hft-stuttgart.de',
     }
   }
-}
+}
\ No newline at end of file
diff --git a/routes/dbconn.js b/routes/dbconn.js
index 834eb1aa..a39f7368 100644
--- a/routes/dbconn.js
+++ b/routes/dbconn.js
@@ -1,6 +1,6 @@
 const mysql = require('mysql')
 
-var env = process.env.NODE_ENV || 'development';
+var env = process.env.NODE_ENV || 'testing';
 const config = require('../config/config')[env]
 
 // ==== USER ACOOUNT DB CONNECTION ====
diff --git a/routes/mailer.js b/routes/mailer.js
index 510b5bb1..2c51bd7d 100644
--- a/routes/mailer.js
+++ b/routes/mailer.js
@@ -1,6 +1,6 @@
 const nodemailer = require('nodemailer')
 
-var env = process.env.NODE_ENV || 'development';
+var env = process.env.NODE_ENV || 'testing';
 const config = require('../config/config')[env]
 
 var smtpTransport = nodemailer.createTransport({
-- 
GitLab