diff --git a/commands/coldbox/reinit.cfc b/commands/coldbox/reinit.cfc index 414206c..2f74fad 100644 --- a/commands/coldbox/reinit.cfc +++ b/commands/coldbox/reinit.cfc @@ -18,19 +18,19 @@ component aliases="fwreinit" { /** * @password The FWReinit password - * @name Name of the CommandBox server to reinit + * @name Name of the CommandBox server to reinit, will default to the name listed in server.json file * @showUrl Show the Url to reinit **/ function run( password = "1", - name = "", + name = getDefaultServerName(), showUrl = true ){ - var serverInfo = serverService.getServerInfoByDiscovery( getCWD(), arguments.name ); + var serverInfo = serverService.getServerInfoByDiscovery( name = arguments.name ); if ( !structCount( serverInfo ) ) { print.boldRedLine( - "No server configurations found for '#getCWD()#', so have no clue what to reinit buddy!" + "No server configurations found for '#getCWD()#' and '#arguments.name#', so have no clue what to reinit buddy!" ); } else { var thisURL = "#serverInfo.host#:#serverInfo.port#/?fwreinit=#arguments.password#"; @@ -50,4 +50,9 @@ component aliases="fwreinit" { } } + private function getDefaultServerName(){ + var serverInfo = serverService.getServerInfoByDiscovery( serverConfigFile = "server.json" ); + return serverInfo.keyExists( "name" ) ? serverInfo.name : ""; + } + }