Skip to content

Commit 3be68af

Browse files
authored
Merge pull request #41 from ColdBox/copilot/fix-webroot-setting-recognition
Fix fwreinit failing to find server when web.webroot is set in server.json
2 parents 0706c63 + d620c66 commit 3be68af

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎commands/coldbox/reinit.cfc‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ component aliases="fwreinit" {
1818

1919
/**
2020
* @password The FWReinit password
21-
* @name Name of the CommandBox server to reinit
21+
* @name Name of the CommandBox server to reinit, will default to the name listed in server.json file
2222
* @showUrl Show the Url to reinit
2323
**/
2424
function run(
2525
password = "1",
26-
name = "",
26+
name = getDefaultServerName(),
2727
showUrl = true
2828
){
29-
var serverInfo = serverService.getServerInfoByDiscovery( getCWD(), arguments.name );
29+
var serverInfo = serverService.getServerInfoByDiscovery( name = arguments.name );
3030

3131
if ( !structCount( serverInfo ) ) {
3232
print.boldRedLine(
33-
"No server configurations found for '#getCWD()#', so have no clue what to reinit buddy!"
33+
"No server configurations found for '#getCWD()#' and '#arguments.name#', so have no clue what to reinit buddy!"
3434
);
3535
} else {
3636
var thisURL = "#serverInfo.host#:#serverInfo.port#/?fwreinit=#arguments.password#";
@@ -50,4 +50,9 @@ component aliases="fwreinit" {
5050
}
5151
}
5252

53+
private function getDefaultServerName(){
54+
var serverInfo = serverService.getServerInfoByDiscovery( serverConfigFile = "server.json" );
55+
return serverInfo.keyExists( "name" ) ? serverInfo.name : "";
56+
}
57+
5358
}

0 commit comments

Comments
 (0)