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:
1 parent
f7553d10d3
commit
0e08ccaefa
6 files changed
+29
-14
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user