11const PortFinder = require ( 'portfinder' ) ;
22const Command = require ( '../ember-cli/lib/models/command' ) ;
3+ import { CliConfig } from '../models/config' ;
34
4- PortFinder . basePort = 49152 ;
5+ const config = CliConfig . fromProject ( ) || CliConfig . fromGlobal ( ) ;
56
6- const defaultPort = process . env . PORT || 4200 ;
7+ const defaultLiveReloadPort = config . get ( 'defaults.serve.liveReloadPort' ) ;
8+ const defaultPort = process . env . PORT || config . get ( 'defaults.serve.port' ) ;
9+ const defaultHost = config . get ( 'defaults.serve.host' ) ;
10+
11+ PortFinder . basePort = defaultLiveReloadPort ;
712
813export interface ServeTaskOptions {
914 port ?: number ;
@@ -43,9 +48,9 @@ const ServeCommand = Command.extend({
4348 {
4449 name : 'host' ,
4550 type : String ,
46- default : 'localhost' ,
51+ default : defaultHost ,
4752 aliases : [ 'H' ] ,
48- description : ' Listens only on localhost by default'
53+ description : ` Listens only on ${ defaultHost } by default`
4954 } ,
5055 { name : 'proxy-config' , type : 'Path' , aliases : [ 'pc' ] } ,
5156 { name : 'watcher' , type : String , default : 'events' , aliases : [ 'w' ] } ,
@@ -66,7 +71,7 @@ const ServeCommand = Command.extend({
6671 name : 'live-reload-port' ,
6772 type : Number ,
6873 aliases : [ 'lrp' ] ,
69- description : '(Defaults to port number within [49152 ...65535])'
74+ description : `Finds the first open port number within [${ defaultLiveReloadPort } ...65535]`
7075 } ,
7176 {
7277 name : 'live-reload-live-css' ,
0 commit comments