mirror of https://github.com/embarklabs/embark.git
Adds log for missing webserver cert and minor fixes
This commit is contained in:
parent
26d66f6e09
commit
ca358b4622
|
@ -483,6 +483,8 @@ Config.prototype.loadWebServerConfigFile = function() {
|
|||
};
|
||||
webServerConfig.protocol = 'https';
|
||||
} catch (e) {
|
||||
this.logger.error(e.message);
|
||||
this.logger.warn('Invalid path for key/cert in config/webserver.js. Using http instead.');
|
||||
webServerConfig.certOptions = {};
|
||||
webServerConfig.protocol = 'http';
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class WebServer {
|
|||
const self = this;
|
||||
|
||||
this.events.request("services:register", 'Webserver', function (cb) {
|
||||
let url = this.protocol + '://' + canonicalHost(self.host) + ':' + self.port;
|
||||
let url = self.protocol + '://' + canonicalHost(self.host) + ':' + self.port;
|
||||
utils.checkIsAvailable(url, function (available) {
|
||||
let devServer = __('Webserver') + ' (' + url + ')';
|
||||
let serverStatus = (available ? 'on' : 'off');
|
||||
|
|
|
@ -32,19 +32,13 @@ function recursiveMerge(target, source) {
|
|||
|
||||
function checkIsAvailable(url, callback) {
|
||||
const protocol = url.split(':')[0];
|
||||
if (protocol === 'http') {
|
||||
http.get(url, function (_res) {
|
||||
callback(true);
|
||||
}).on('error', function (_res) {
|
||||
callback(false);
|
||||
});
|
||||
} else if (protocol === 'https') {
|
||||
https.get(url, function (_res) {
|
||||
callback(true);
|
||||
}).on('error', function (_res) {
|
||||
callback(false);
|
||||
});
|
||||
}
|
||||
const httpObj = (protocol === 'https') ? https : http;
|
||||
|
||||
httpObj.get(url, function (_res) {
|
||||
callback(true);
|
||||
}).on('error', function (_res) {
|
||||
callback(false);
|
||||
});
|
||||
}
|
||||
|
||||
function httpGetRequest(httpObj, url, callback) {
|
||||
|
|
Loading…
Reference in New Issue