Own ConfigManager in Core; resolve config via DI instead of the singleton

Core holds a ConfigManager member, keeps it synced (updateConfig(config_)),
and provides it as a service. ConfigManager.cpp drops the instance()
definition. MusicManager gets the manager via setConfigManager() and reads
sections through it (former ECHOION_BOT/YOUTUBE/NETWORK sites); RpcInfoCommand
resolves it from the registry via ctx.service<Api::ConfigManager>(). Build
green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-23 14:01:31 +03:00
1 parent f7553d10d3
commit 0e08ccaefa
6 files changed
+29 -14

No files matched your search

+4 -4
View File
@@ -23,9 +23,9 @@ namespace Echoion::Core
database)
{
// Get config from global ConfigManager
const auto& botConfig = ECHOION_BOT;
const auto& youtubeConfig = ECHOION_YOUTUBE;
const auto& networkConfig = ECHOION_NETWORK;
const auto& botConfig = configManager_->getBot();
const auto& youtubeConfig = configManager_->getYouTube();
const auto& networkConfig = configManager_->getNetwork();
config_ = botConfig;
networkClient_ = std::move(networkClient);
@@ -229,7 +229,7 @@ namespace Echoion::Core
// If direct open fails and we have a proxy, try downloading through
// proxy
const auto& networkConfig = ECHOION_NETWORK;
const auto& networkConfig = configManager_->getNetwork();
if (!openResult && networkConfig.proxy.has_value() &&
networkConfig.proxy->enabled()) {
ECHOION_LOG_INFO(