summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-03-15 10:50:37 +0800
committerCheng-Han, Wu2016-03-15 10:50:37 +0800
commitef1436c7d66d8d9e6128b8e40dea9d4ba0ef68f3 (patch)
tree2c631fb68f83156dde0ff9e37ad187fe580d0dd6
parent526f5c7e2eeee21ef9d87bda8668903844e95f53 (diff)
Added protocol use ssl option in config
Diffstat (limited to '')
-rw-r--r--README.md1
-rw-r--r--config.js11
2 files changed, 8 insertions, 4 deletions
diff --git a/README.md b/README.md
index cff1cb62..0acbdd75 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,7 @@ Server-side config.js settings
| testport | `3000` | debug web port, fallback to this when not set in environment |
| testsslport | `3001` | debug web ssl port, fallback to this when not set in environment |
| usessl | `true` or `false` | set to use ssl |
+| protocolusessl | `true` or `false` | set to use ssl protocol |
| urladdport | `true` or `false` | set to add port on oauth callback url |
| debug | `true` or `false` | set debug mode, show more logs |
| usecdn | `true` or `false` | set to use CDN resources or not |
diff --git a/config.js b/config.js
index 69f44a06..972fc3b4 100644
--- a/config.js
+++ b/config.js
@@ -7,11 +7,12 @@ var testport = '3000';
var testsslport = '3001';
var port = process.env.PORT || testport;
var sslport = process.env.SSLPORT || testsslport;
-var usessl = false;
+var usessl = false; // use node https server
+var protocolusessl = false; // use ssl protocol
var urladdport = true; //add port on getserverurl
var config = {
- debug: true,
+ debug: false,
usecdn: false,
version: '0.3.4',
domain: domain,
@@ -26,12 +27,14 @@ var config = {
sslcapath: ['change this'],
dhparampath: 'change this',
usessl: usessl,
+ protocolusessl: protocolusessl,
getserverurl: function() {
+ var protocol = protocolusessl ? 'https://' : 'http://';
var url = domain;
if (usessl)
- url = 'https://' + url + (sslport == 443 || !urladdport ? '' : ':' + sslport);
+ url = protocol + url + (sslport == 443 || !urladdport ? '' : ':' + sslport);
else
- url = 'http://' + url + (port == 80 || !urladdport ? '' : ':' + port);
+ url = protocol + url + (port == 80 || !urladdport ? '' : ':' + port);
if (urlpath)
url = url + '/' + urlpath;
return url;