[cli/serve] allow disabling the base path proxy if needed

This commit is contained in:
spalger 2016-01-21 16:52:25 -07:00
parent 7db9c91d90
commit 1b85822e26
3 changed files with 12 additions and 5 deletions

View file

@ -15,7 +15,9 @@ module.exports = class ClusterManager {
this.log = new Log(opts.quiet, opts.silent);
this.addedCount = 0;
this.basePathProxy = new BasePathProxy(this, settings);
if (opts.basePathProxy) {
this.basePathProxy = new BasePathProxy(this, settings);
}
this.workers = [
this.optimizer = new Worker({
@ -25,7 +27,7 @@ module.exports = class ClusterManager {
argv: compact([
'--plugins.initialize=false',
'--server.autoListen=false',
`--server.basePath=${this.basePathProxy.basePath}`
this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}`
]),
watch: false
}),
@ -34,8 +36,8 @@ module.exports = class ClusterManager {
type: 'server',
log: this.log,
argv: compact([
`--server.port=${this.basePathProxy.targetPort}`,
`--server.basePath=${this.basePathProxy.basePath}`
this.basePathProxy && `--server.port=${this.basePathProxy.targetPort}`,
this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}`
])
})
];
@ -60,7 +62,9 @@ module.exports = class ClusterManager {
startCluster() {
this.setupManualRestart();
invoke(this.workers, 'start');
this.basePathProxy.listen();
if (this.basePathProxy) {
this.basePathProxy.listen();
}
}
setupWatching() {

View file

@ -107,6 +107,7 @@ module.exports = function (program) {
command
.option('--dev', 'Run the server with development mode defaults')
.option('--no-ssl', 'Don\'t run the dev server using HTTPS')
.option('--no-base-path', 'Don\'t put a proxy in front of the dev server, which adds a random basePath')
.option('--no-watch', 'Prevents automatic restarts of the server in --dev mode');
}

View file

@ -86,6 +86,8 @@ module.exports = function (grunt) {
args: [
'--dev',
'--no-watch',
'--no-ssl',
'--no-base-path',
'--server.port=5610',
'--optimize.lazyPort=5611',
'--optimize.lazyPrebuild=true',