diff options
| author | Stefan Boberg <[email protected]> | 2021-09-23 12:39:22 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-23 12:39:22 +0200 |
| commit | 6475458866463133aae760e938b27d98b6ead3d3 (patch) | |
| tree | 5b69ca464a18e996b3c060dcaa6e1ae5ac8e2090 /zenserver/config.cpp | |
| parent | cidstore: made all updates log using LogMapping() (diff) | |
| parent | Use /check/health instead of /test/hello. (diff) | |
| download | zen-6475458866463133aae760e938b27d98b6ead3d3.tar.xz zen-6475458866463133aae760e938b27d98b6ead3d3.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver/config.cpp')
| -rw-r--r-- | zenserver/config.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp index 164d2a792..c21638258 100644 --- a/zenserver/config.cpp +++ b/zenserver/config.cpp @@ -17,6 +17,8 @@ #include <zencore/logging.h> #include <sol/sol.hpp> +#include <conio.h> + #if ZEN_PLATFORM_WINDOWS // Used for getting My Documents for default data directory @@ -219,7 +221,8 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z if (result.count("help")) { zen::logging::ConsoleLog().info("{}", options.help()); - + zen::logging::ConsoleLog().info("Press any key to exit!"); + _getch(); exit(0); } @@ -274,14 +277,24 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv try { - sol::load_result config = lua.load(std::string_view((const char*)LuaScript.Data(), LuaScript.Size()), "zencfg"); + sol::load_result config = lua.load(std::string_view((const char*)LuaScript.Data(), LuaScript.Size()), "zen_cfg"); + + if (!config.valid()) + { + sol::error err = config; + + std::string ErrorString = sol::to_string(config.status()); + + throw std::runtime_error("{} error: {}"_format(ErrorString, err.what())); + } + config(); } catch (std::exception& e) { - ZEN_ERROR("config script failure: {}", e.what()); + ZEN_ERROR("config failure: {}", e.what()); - throw std::runtime_error("fatal zen global config script ({}) failure: {}"_format(ConfigScript, e.what()).c_str()); + throw std::runtime_error("failed to run global config script ('{}'): {}"_format(ConfigScript, e.what()).c_str()); } ServiceConfig.MeshEnabled = lua["mesh"]["enable"].get_or(ServiceConfig.MeshEnabled); |