Skip to content

Commit d620c66

Browse files
Copilotlmajano
andcommitted
Fix fwreinit not recognizing webroot setting in server.json
Agent-Logs-Url: https://github.com/ColdBox/coldbox-cli/sessions/23d22b0d-2e9c-43e3-9a8b-475aa8bc5460 Co-authored-by: lmajano <137111+lmajano@users.noreply.github.com>
1 parent 1cc2bcd commit d620c66

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)