don't output agree-tos and email message for localhost

This commit is contained in:
AJ ONeal 2017-02-02 18:15:54 -07:00
parent f0bea933f9
commit e12164d3dc
1 changed files with 8 additions and 3 deletions

View File

@ -347,17 +347,19 @@ function run() {
opts.sites = [ { name: defaultServername , path: '.' } ]; opts.sites = [ { name: defaultServername , path: '.' } ];
if (argv.sites) { if (argv.sites) {
opts._externalHost = false;
opts.sites = argv.sites.split(',').map(function (name) { opts.sites = argv.sites.split(',').map(function (name) {
var nameparts = name.split('|'); var nameparts = name.split('|');
var servername = nameparts.shift();
opts._externalHost = opts._externalHost || !/(^|\.)localhost\./.test(servername);
// TODO allow reverse proxy // TODO allow reverse proxy
return { return {
name: nameparts.shift() name: servername
// there should always be a path // there should always be a path
, paths: nameparts.length && nameparts || [ defaultWebRoot ] , paths: nameparts.length && nameparts || [ defaultWebRoot ]
}; };
}); });
} }
console.log('opts.sites', opts.sites);
// TODO use arrays in all things // TODO use arrays in all things
opts._old_server_name = opts.sites[0].name; opts._old_server_name = opts.sites[0].name;
opts.pubdir = defaultWebRoot; opts.pubdir = defaultWebRoot;
@ -381,7 +383,7 @@ function run() {
opts.expressApp = require(path.resolve(process.cwd(), argv['express-app'])); opts.expressApp = require(path.resolve(process.cwd(), argv['express-app']));
} }
if (opts.email || argv.sites) { if (opts.email || opts._externalHost) {
if (!opts.agreeTos) { if (!opts.agreeTos) {
console.warn("You may need to specify --agree-tos to agree to both the Let's Encrypt and Daplie DNS terms of service."); console.warn("You may need to specify --agree-tos to agree to both the Let's Encrypt and Daplie DNS terms of service.");
} }
@ -442,6 +444,9 @@ function run() {
console.info(''); console.info('');
if (!(argv.sites && (defaultServername !== argv.sites) && !(argv.key && argv.cert))) { if (!(argv.sites && (defaultServername !== argv.sites) && !(argv.key && argv.cert))) {
// TODO what is this condition actually intending to test again?
// (I think it can be replaced with if (!opts._externalHost) { ... }
// ifaces // ifaces
opts.ifaces = require('../lib/local-ip.js').find(); opts.ifaces = require('../lib/local-ip.js').find();
promise = PromiseA.resolve(); promise = PromiseA.resolve();