From 50ea6da36c9826c7c7be688bdcd0c3f4eafef6f2 Mon Sep 17 00:00:00 2001 From: Wade Wegner Date: Sat, 9 Sep 2017 19:52:15 -0700 Subject: [PATCH] Updates for HTTPS and UX --- app.js | 35 +++++++++++++++++++++++++++++++---- dist/assets/css/main.css | 2 +- package.json | 1 + src/scss/main.scss | 2 +- views/partials/footer.ejs | 10 +++++----- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index a738b01..b9bf46c 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,7 @@ const express = require('express'); const bodyParser = require('body-parser'); const cookieParser = require('cookie-parser'); +const https = require('https'); const app = express(); const router = express.Router(); @@ -21,7 +22,33 @@ require('./lib/app-router')(router); app.use('/api', router); -const port = process.env.PORT || 8080; -app.listen(port, () => { - console.log(`Example app listening on port ${port}!`); -}); \ No newline at end of file + + +const port = process.env.PORT || 8443; + +// if local, use 8443 and certificate +if (process.env.NODE_ENV === 'dev') { + + const passPhrase = process.env.PASS_PHRASE; + const certPem = process.env.CERT_PEM.replace(/\\n/g, '\n'); + const keyPem = process.env.KEY_PEM.replace(/\\n/g, '\n'); + + const sslOptions = { + key: keyPem, + cert: certPem, + passphrase: passPhrase + }; + + const httpsServer = https.createServer(sslOptions, app); + + httpsServer.listen(port, () => { + console.log(`Example app listening on port ${port}!`); + }); + +} else { + + app.listen(port, () => { + console.log(`Example app listening on port ${port}!`); + }); + +} \ No newline at end of file diff --git a/dist/assets/css/main.css b/dist/assets/css/main.css index b6c29a1..ef0b0ce 100644 --- a/dist/assets/css/main.css +++ b/dist/assets/css/main.css @@ -19394,7 +19394,7 @@ a.sfdx-logo:visited { resize: none; } .sfdx-slim { - margin: 0 15%; } + margin: 0 5%; } .sfdx-wrap { word-wrap: break-word; } diff --git a/package.json b/package.json index f4128f0..df099fa 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "cookie-parser": "^1.4.3", "ejs": "^2.5.6", "express": "^4.15.3", + "https": "^1.0.0", "jsforce": "^1.8.0", "pg": "^7.1.2", "pg-pool": "^2.0.3", diff --git a/src/scss/main.scss b/src/scss/main.scss index 69c540d..7d195cd 100644 --- a/src/scss/main.scss +++ b/src/scss/main.scss @@ -34,7 +34,7 @@ a.sfdx-logo:visited { } .sfdx-slim { - margin:0 15%; + margin:0 5%; } .sfdx-wrap { diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index 964f2b6..d9388af 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -1,9 +1,9 @@ - + User experience designed by Ben Snyder. + Contributions from Andrew Fawcett. + \ No newline at end of file