Skip to content

Commit

Permalink
Log all applied config files #286
Browse files Browse the repository at this point in the history
  • Loading branch information
geneotech committed Jun 18, 2024
1 parent 0b8072e commit 2f79e35
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/application/setups/server/server_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ class webrtc_server_detail {
const bool udp_mux
) {
LOG("Web port range: %x-%x", ports_begin, ports_end);
LOG("Web UDP port mux: %x", udp_mux);
self->config.iceServers = iceServers;
#if PLATFORM_WEB
(void)ports_begin;
Expand Down
46 changes: 25 additions & 21 deletions src/work.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ work_result work(
LOG("Creating lua state.");
WEBSTATIC auto lua = augs::create_lua_state();

LOG("Loading the config.");
LOG("Loading %x.", canon_config_path);

WEBSTATIC const auto canon_config_ptr = [&]() {
auto result_ptr = std::make_unique<config_lua_table>(
Expand All @@ -438,42 +438,27 @@ work_result work(

WEBSTATIC auto& canon_config = *canon_config_ptr;

if (!params.assign_teams.empty()) {
LOG("Reading server assigned teams from: %x", CALLING_CWD / params.assign_teams);
}

#if BUILD_NETWORKING
WEBSTATIC const auto assigned_teams =
params.assign_teams.empty() ?
server_assigned_teams() :
server_assigned_teams(CALLING_CWD / params.assign_teams)
;

if (params.type == app_type::DEDICATED_SERVER && params.assign_teams.empty()) {
LOG("No players were assigned to teams for this dedicated server session.");
}
else {
LOG("Assigned teams: %x", assigned_teams.id_to_faction);
}
#endif

WEBSTATIC auto config_ptr = [&]() {
auto result = std::make_unique<config_lua_table>(canon_config);

if (augs::exists(local_config_path)) {
LOG("Applying config: %x", local_config_path);
result->load_patch(lua, local_config_path);
}

if (!params.apply_config.empty()) {
const auto cli_config_path = CALLING_CWD / params.apply_config;
LOG("Applying config: %x", cli_config_path);
result->load_patch(lua, cli_config_path);
}

if (augs::exists(force_config_path)) {
LOG("Applying config: %x", force_config_path);
result->load_patch(lua, force_config_path);
}

if (augs::exists(private_config_path)) {
LOG("Applying config: %x", private_config_path);
result->load_patch(lua, private_config_path);
}

Expand Down Expand Up @@ -514,7 +499,26 @@ work_result work(
return result;
}();

LOG("Loaded user configs.");
LOG("Loaded all user configs.");

if (!params.assign_teams.empty()) {
LOG("Reading server assigned teams from: %x", CALLING_CWD / params.assign_teams);
}

#if BUILD_NETWORKING
WEBSTATIC const auto assigned_teams =
params.assign_teams.empty() ?
server_assigned_teams() :
server_assigned_teams(CALLING_CWD / params.assign_teams)
;

if (params.type == app_type::DEDICATED_SERVER && params.assign_teams.empty()) {
LOG("No players were assigned to teams for this dedicated server session.");
}
else {
LOG("Assigned teams: %x", assigned_teams.id_to_faction);
}
#endif

WEBSTATIC auto& config = *config_ptr;

Expand Down

0 comments on commit 2f79e35

Please sign in to comment.