From 4963919773219b2c81f9b81627dcf1776301733c Mon Sep 17 00:00:00 2001 From: Lord-Turmoil Date: Sun, 1 Dec 2024 13:15:37 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=92=EF=B8=8Fuse=20different=20appsettings?= =?UTF-8?q?=20from=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/WebHostBuilder.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/WebHostBuilder.cpp b/src/core/WebHostBuilder.cpp index 6ce4d97..df65dd2 100644 --- a/src/core/WebHostBuilder.cpp +++ b/src/core/WebHostBuilder.cpp @@ -8,6 +8,7 @@ #include "components/MayhemServer.h" #include "components/RequestDispatcher.h" +#include #include #include @@ -35,6 +36,14 @@ Ref WebHostBuilder::UseAppSettings(const std::string& path) _initialized = true; _appSettingsPath = path; + if (_appSettingsPath == "appsettings.json") + { + const char* env = std::getenv("MINET_CORE_ENV"); + if (env) + { + _appSettingsPath = std::string("appsettings.") + env + ".json"; + } + } _InitializeComponents(); return shared_from_this();