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

+7 -2
View File
@@ -74,8 +74,13 @@ namespace Echoion::Core
void RpcInfoCommand::execute(const CommandContext& ctx)
{
// Get RPC configuration from global ConfigManager
const auto& networkConfig = ECHOION_NETWORK;
// Resolve RPC configuration from the service registry.
auto configManager = ctx.service<Api::ConfigManager>();
if (!configManager) {
ctx.reply("Configuration service unavailable");
return;
}
const auto& networkConfig = configManager->getNetwork();
uint16_t rpcPort = networkConfig.rpcPort;
std::string rpcBindAddress = networkConfig.rpcBindAddress;