From 9e35f16be163638060266a3ab8afae2d3a6aa1bc Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 29 Jul 2025 11:52:41 +0100 Subject: [PATCH] chore: Move config definition to cpp file (#2371) Having such a long init list in almost every translation unit is definitely not nice. It makes it more difficult to work on custom logger (because I need to adjust log_format), so let's move it to cpp file --- src/app/VerifyConfig.hpp | 2 +- src/main/Main.cpp | 5 +- src/util/config/ConfigDefinition.cpp | 163 ++++++++++++++++++++++++++ src/util/config/ConfigDefinition.hpp | 150 +----------------------- src/util/config/ConfigDescription.hpp | 4 +- tests/unit/app/CliArgsTests.cpp | 2 +- 6 files changed, 172 insertions(+), 154 deletions(-) diff --git a/src/app/VerifyConfig.hpp b/src/app/VerifyConfig.hpp index 298fbafa..c0af108d 100644 --- a/src/app/VerifyConfig.hpp +++ b/src/app/VerifyConfig.hpp @@ -44,7 +44,7 @@ parseConfig(std::string_view configPath) std::cerr << "Error parsing json from config: " << configPath << "\n" << json.error().error << std::endl; return false; } - auto const errors = gClioConfig.parse(json.value()); + auto const errors = getClioConfig().parse(json.value()); if (errors.has_value()) { for (auto const& err : errors.value()) { std::cerr << "Issues found in provided config '" << configPath << "':\n"; diff --git a/src/main/Main.cpp b/src/main/Main.cpp index 003db648..313bd809 100644 --- a/src/main/Main.cpp +++ b/src/main/Main.cpp @@ -53,6 +53,7 @@ try { if (not app::parseConfig(run.configPath)) return EXIT_FAILURE; + ClioConfigDefinition& gClioConfig = getClioConfig(); PrometheusService::init(gClioConfig); if (auto const initSuccess = util::LogService::init(gClioConfig); not initSuccess) { std::cerr << initSuccess.error() << std::endl; @@ -65,11 +66,11 @@ try { if (not app::parseConfig(migrate.configPath)) return EXIT_FAILURE; - if (auto const initSuccess = util::LogService::init(gClioConfig); not initSuccess) { + if (auto const initSuccess = util::LogService::init(getClioConfig()); not initSuccess) { std::cerr << initSuccess.error() << std::endl; return EXIT_FAILURE; } - app::MigratorApplication migrator{gClioConfig, migrate.subCmd}; + app::MigratorApplication migrator{getClioConfig(), migrate.subCmd}; return migrator.run(); } ); diff --git a/src/util/config/ConfigDefinition.cpp b/src/util/config/ConfigDefinition.cpp index 647a354d..ea13cd36 100644 --- a/src/util/config/ConfigDefinition.cpp +++ b/src/util/config/ConfigDefinition.cpp @@ -240,4 +240,167 @@ ClioConfigDefinition::parse(ConfigFileInterface const& config) return std::nullopt; } +ClioConfigDefinition& +getClioConfig() +{ + static ClioConfigDefinition gClioConfig{ + {{"database.type", + ConfigValue{ConfigType::String}.defaultValue("cassandra").withConstraint(gValidateCassandraName)}, + {"database.cassandra.contact_points", ConfigValue{ConfigType::String}.defaultValue("localhost")}, + {"database.cassandra.secure_connect_bundle", ConfigValue{ConfigType::String}.optional()}, + {"database.cassandra.port", ConfigValue{ConfigType::Integer}.withConstraint(gValidatePort).optional()}, + {"database.cassandra.keyspace", ConfigValue{ConfigType::String}.defaultValue("clio")}, + {"database.cassandra.replication_factor", + ConfigValue{ConfigType::Integer}.defaultValue(3u).withConstraint(gValidateReplicationFactor)}, + {"database.cassandra.table_prefix", ConfigValue{ConfigType::String}.optional()}, + {"database.cassandra.max_write_requests_outstanding", + ConfigValue{ConfigType::Integer}.defaultValue(10'000).withConstraint(gValidateUint32)}, + {"database.cassandra.max_read_requests_outstanding", + ConfigValue{ConfigType::Integer}.defaultValue(100'000).withConstraint(gValidateUint32)}, + {"database.cassandra.threads", + ConfigValue{ConfigType::Integer} + .defaultValue( + static_cast(std::thread::hardware_concurrency()), "The number of available CPU cores." + ) + .withConstraint(gValidateUint32)}, + {"database.cassandra.core_connections_per_host", + ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint16)}, + {"database.cassandra.queue_size_io", + ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint16)}, + {"database.cassandra.write_batch_size", + ConfigValue{ConfigType::Integer}.defaultValue(20).withConstraint(gValidateUint16)}, + {"database.cassandra.connect_timeout", + ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, + {"database.cassandra.request_timeout", + ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, + {"database.cassandra.username", ConfigValue{ConfigType::String}.optional()}, + {"database.cassandra.password", ConfigValue{ConfigType::String}.optional()}, + {"database.cassandra.certfile", ConfigValue{ConfigType::String}.optional()}, + + {"allow_no_etl", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, + {"__ng_etl", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, + {"etl_sources.[].ip", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateIp)}}, + {"etl_sources.[].ws_port", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidatePort)}}, + {"etl_sources.[].grpc_port", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidatePort)}}, + + {"forwarding.cache_timeout", + ConfigValue{ConfigType::Double}.defaultValue(0.0).withConstraint(gValidatePositiveDouble)}, + {"forwarding.request_timeout", + ConfigValue{ConfigType::Double}.defaultValue(10.0).withConstraint(gValidatePositiveDouble)}, + + {"rpc.cache_timeout", + ConfigValue{ConfigType::Double}.defaultValue(0.0).withConstraint(gValidatePositiveDouble)}, + + {"num_markers", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNumMarkers)}, + + {"dos_guard.whitelist.[]", Array{ConfigValue{ConfigType::String}.optional()}}, + {"dos_guard.max_fetches", + ConfigValue{ConfigType::Integer}.defaultValue(1000'000u).withConstraint(gValidateUint32)}, + {"dos_guard.max_connections", + ConfigValue{ConfigType::Integer}.defaultValue(20u).withConstraint(gValidateUint32)}, + {"dos_guard.max_requests", ConfigValue{ConfigType::Integer}.defaultValue(20u).withConstraint(gValidateUint32)}, + {"dos_guard.sweep_interval", + ConfigValue{ConfigType::Double}.defaultValue(1.0).withConstraint(gValidatePositiveDouble)}, + {"dos_guard.__ng_default_weight", + ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateNonNegativeUint32)}, + {"dos_guard.__ng_weights.[].method", + Array{ConfigValue{ConfigType::String}.withConstraint(gRpcNameConstraint)}}, + {"dos_guard.__ng_weights.[].weight", + Array{ConfigValue{ConfigType::Integer}.withConstraint(gValidateNonNegativeUint32)}}, + {"dos_guard.__ng_weights.[].weight_ledger_current", + Array{ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNonNegativeUint32)}}, + {"dos_guard.__ng_weights.[].weight_ledger_validated", + Array{ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNonNegativeUint32)}}, + + {"workers", + ConfigValue{ConfigType::Integer} + .defaultValue(std::thread::hardware_concurrency(), "The number of available CPU cores.") + .withConstraint(gValidateUint32)}, + {"server.ip", ConfigValue{ConfigType::String}.withConstraint(gValidateIp)}, + {"server.port", ConfigValue{ConfigType::Integer}.withConstraint(gValidatePort)}, + {"server.max_queue_size", ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint32)}, + {"server.local_admin", ConfigValue{ConfigType::Boolean}.optional()}, + {"server.admin_password", ConfigValue{ConfigType::String}.optional()}, + {"server.processing_policy", + ConfigValue{ConfigType::String}.defaultValue("parallel").withConstraint(gValidateProcessingPolicy)}, + {"server.parallel_requests_limit", + ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint16)}, + {"server.ws_max_sending_queue_size", + ConfigValue{ConfigType::Integer}.defaultValue(1500).withConstraint(gValidateUint32)}, + {"server.__ng_web_server", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, + + {"prometheus.enabled", ConfigValue{ConfigType::Boolean}.defaultValue(true)}, + {"prometheus.compress_reply", ConfigValue{ConfigType::Boolean}.defaultValue(true)}, + + {"io_threads", ConfigValue{ConfigType::Integer}.defaultValue(2).withConstraint(gValidateUint16)}, + + {"subscription_workers", ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint32)}, + + {"graceful_period", + ConfigValue{ConfigType::Double}.defaultValue(10.0).withConstraint(gValidatePositiveDouble)}, + + {"cache.num_diffs", ConfigValue{ConfigType::Integer}.defaultValue(32).withConstraint(gValidateUint16)}, + {"cache.num_markers", ConfigValue{ConfigType::Integer}.defaultValue(48).withConstraint(gValidateUint16)}, + {"cache.num_cursors_from_diff", + ConfigValue{ConfigType::Integer}.defaultValue(0).withConstraint(gValidateNumCursors)}, + {"cache.num_cursors_from_account", + ConfigValue{ConfigType::Integer}.defaultValue(0).withConstraint(gValidateNumCursors)}, + {"cache.page_fetch_size", ConfigValue{ConfigType::Integer}.defaultValue(512).withConstraint(gValidateUint16)}, + {"cache.load", ConfigValue{ConfigType::String}.defaultValue("async").withConstraint(gValidateLoadMode)}, + + {"log_channels.[].channel", + Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateChannelName)}}, + {"log_channels.[].log_level", + Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateLogLevelName)}}, + + {"log_level", ConfigValue{ConfigType::String}.defaultValue("info").withConstraint(gValidateLogLevelName)}, + + {"log_format", + ConfigValue{ConfigType::String}.defaultValue( + R"(%TimeStamp% (%SourceLocation%) [%ThreadID%] %Channel%:%Severity% %Message%)" + )}, + + {"log_to_console", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, + + {"log_directory", ConfigValue{ConfigType::String}.optional()}, + + {"log_rotation_size", ConfigValue{ConfigType::Integer}.defaultValue(2048).withConstraint(gValidateUint32)}, + + {"log_directory_max_size", + ConfigValue{ConfigType::Integer}.defaultValue(50 * 1024).withConstraint(gValidateUint32)}, + + {"log_rotation_hour_interval", + ConfigValue{ConfigType::Integer}.defaultValue(12).withConstraint(gValidateUint32)}, + + {"log_tag_style", ConfigValue{ConfigType::String}.defaultValue("none").withConstraint(gValidateLogTag)}, + + {"extractor_threads", ConfigValue{ConfigType::Integer}.defaultValue(1u).withConstraint(gValidateUint32)}, + + {"read_only", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, + + {"start_sequence", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, + + {"finish_sequence", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, + + {"ssl_cert_file", ConfigValue{ConfigType::String}.optional()}, + + {"ssl_key_file", ConfigValue{ConfigType::String}.optional()}, + + {"api_version.default", + ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_DEFAULT).withConstraint(gValidateApiVersion)}, + {"api_version.min", + ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_MIN).withConstraint(gValidateApiVersion)}, + {"api_version.max", + ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_MAX).withConstraint(gValidateApiVersion)}, + + {"migration.full_scan_threads", + ConfigValue{ConfigType::Integer}.defaultValue(2).withConstraint(gValidateUint32)}, + {"migration.full_scan_jobs", ConfigValue{ConfigType::Integer}.defaultValue(4).withConstraint(gValidateUint32)}, + {"migration.cursors_per_job", + ConfigValue{ConfigType::Integer}.defaultValue(100).withConstraint(gValidateUint32)}}, + }; + + return gClioConfig; +} + } // namespace util::config diff --git a/src/util/config/ConfigDefinition.hpp b/src/util/config/ConfigDefinition.hpp index 6e326939..5eebb9f0 100644 --- a/src/util/config/ConfigDefinition.hpp +++ b/src/util/config/ConfigDefinition.hpp @@ -258,153 +258,7 @@ private: * Specifies which keys are valid in Clio Config and provides default values if user's do not specify one. Those * without default values must be present in the user's config file. */ -static ClioConfigDefinition gClioConfig = ClioConfigDefinition{ - {{"database.type", - ConfigValue{ConfigType::String}.defaultValue("cassandra").withConstraint(gValidateCassandraName)}, - {"database.cassandra.contact_points", ConfigValue{ConfigType::String}.defaultValue("localhost")}, - {"database.cassandra.secure_connect_bundle", ConfigValue{ConfigType::String}.optional()}, - {"database.cassandra.port", ConfigValue{ConfigType::Integer}.withConstraint(gValidatePort).optional()}, - {"database.cassandra.keyspace", ConfigValue{ConfigType::String}.defaultValue("clio")}, - {"database.cassandra.replication_factor", - ConfigValue{ConfigType::Integer}.defaultValue(3u).withConstraint(gValidateReplicationFactor)}, - {"database.cassandra.table_prefix", ConfigValue{ConfigType::String}.optional()}, - {"database.cassandra.max_write_requests_outstanding", - ConfigValue{ConfigType::Integer}.defaultValue(10'000).withConstraint(gValidateUint32)}, - {"database.cassandra.max_read_requests_outstanding", - ConfigValue{ConfigType::Integer}.defaultValue(100'000).withConstraint(gValidateUint32)}, - {"database.cassandra.threads", - ConfigValue{ConfigType::Integer} - .defaultValue( - static_cast(std::thread::hardware_concurrency()), - "The number of available CPU cores." - ) - .withConstraint(gValidateUint32)}, - {"database.cassandra.core_connections_per_host", - ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint16)}, - {"database.cassandra.queue_size_io", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint16)}, - {"database.cassandra.write_batch_size", - ConfigValue{ConfigType::Integer}.defaultValue(20).withConstraint(gValidateUint16)}, - {"database.cassandra.connect_timeout", - ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, - {"database.cassandra.request_timeout", - ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, - {"database.cassandra.username", ConfigValue{ConfigType::String}.optional()}, - {"database.cassandra.password", ConfigValue{ConfigType::String}.optional()}, - {"database.cassandra.certfile", ConfigValue{ConfigType::String}.optional()}, - - {"allow_no_etl", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, - {"__ng_etl", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, - {"etl_sources.[].ip", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateIp)}}, - {"etl_sources.[].ws_port", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidatePort)}}, - {"etl_sources.[].grpc_port", Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidatePort)}}, - - {"forwarding.cache_timeout", - ConfigValue{ConfigType::Double}.defaultValue(0.0).withConstraint(gValidatePositiveDouble)}, - {"forwarding.request_timeout", - ConfigValue{ConfigType::Double}.defaultValue(10.0).withConstraint(gValidatePositiveDouble)}, - - {"rpc.cache_timeout", ConfigValue{ConfigType::Double}.defaultValue(0.0).withConstraint(gValidatePositiveDouble)}, - - {"num_markers", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNumMarkers)}, - - {"dos_guard.whitelist.[]", Array{ConfigValue{ConfigType::String}.optional()}}, - {"dos_guard.max_fetches", - ConfigValue{ConfigType::Integer}.defaultValue(1000'000u).withConstraint(gValidateUint32)}, - {"dos_guard.max_connections", ConfigValue{ConfigType::Integer}.defaultValue(20u).withConstraint(gValidateUint32)}, - {"dos_guard.max_requests", ConfigValue{ConfigType::Integer}.defaultValue(20u).withConstraint(gValidateUint32)}, - {"dos_guard.sweep_interval", - ConfigValue{ConfigType::Double}.defaultValue(1.0).withConstraint(gValidatePositiveDouble)}, - {"dos_guard.__ng_default_weight", - ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateNonNegativeUint32)}, - {"dos_guard.__ng_weights.[].method", Array{ConfigValue{ConfigType::String}.withConstraint(gRpcNameConstraint)}}, - {"dos_guard.__ng_weights.[].weight", - Array{ConfigValue{ConfigType::Integer}.withConstraint(gValidateNonNegativeUint32)}}, - {"dos_guard.__ng_weights.[].weight_ledger_current", - Array{ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNonNegativeUint32)}}, - {"dos_guard.__ng_weights.[].weight_ledger_validated", - Array{ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateNonNegativeUint32)}}, - - {"workers", - ConfigValue{ConfigType::Integer} - .defaultValue(std::thread::hardware_concurrency(), "The number of available CPU cores.") - .withConstraint(gValidateUint32)}, - {"server.ip", ConfigValue{ConfigType::String}.withConstraint(gValidateIp)}, - {"server.port", ConfigValue{ConfigType::Integer}.withConstraint(gValidatePort)}, - {"server.max_queue_size", ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint32)}, - {"server.local_admin", ConfigValue{ConfigType::Boolean}.optional()}, - {"server.admin_password", ConfigValue{ConfigType::String}.optional()}, - {"server.processing_policy", - ConfigValue{ConfigType::String}.defaultValue("parallel").withConstraint(gValidateProcessingPolicy)}, - {"server.parallel_requests_limit", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint16)}, - {"server.ws_max_sending_queue_size", - ConfigValue{ConfigType::Integer}.defaultValue(1500).withConstraint(gValidateUint32)}, - {"server.__ng_web_server", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, - - {"prometheus.enabled", ConfigValue{ConfigType::Boolean}.defaultValue(true)}, - {"prometheus.compress_reply", ConfigValue{ConfigType::Boolean}.defaultValue(true)}, - - {"io_threads", ConfigValue{ConfigType::Integer}.defaultValue(2).withConstraint(gValidateUint16)}, - - {"subscription_workers", ConfigValue{ConfigType::Integer}.defaultValue(1).withConstraint(gValidateUint32)}, - - {"graceful_period", ConfigValue{ConfigType::Double}.defaultValue(10.0).withConstraint(gValidatePositiveDouble)}, - - {"cache.num_diffs", ConfigValue{ConfigType::Integer}.defaultValue(32).withConstraint(gValidateUint16)}, - {"cache.num_markers", ConfigValue{ConfigType::Integer}.defaultValue(48).withConstraint(gValidateUint16)}, - {"cache.num_cursors_from_diff", - ConfigValue{ConfigType::Integer}.defaultValue(0).withConstraint(gValidateNumCursors)}, - {"cache.num_cursors_from_account", - ConfigValue{ConfigType::Integer}.defaultValue(0).withConstraint(gValidateNumCursors)}, - {"cache.page_fetch_size", ConfigValue{ConfigType::Integer}.defaultValue(512).withConstraint(gValidateUint16)}, - {"cache.load", ConfigValue{ConfigType::String}.defaultValue("async").withConstraint(gValidateLoadMode)}, - - {"log_channels.[].channel", - Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateChannelName)}}, - {"log_channels.[].log_level", - Array{ConfigValue{ConfigType::String}.optional().withConstraint(gValidateLogLevelName)}}, - - {"log_level", ConfigValue{ConfigType::String}.defaultValue("info").withConstraint(gValidateLogLevelName)}, - - {"log_format", - ConfigValue{ConfigType::String}.defaultValue( - R"(%TimeStamp% (%SourceLocation%) [%ThreadID%] %Channel%:%Severity% %Message%)" - )}, - - {"log_to_console", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, - - {"log_directory", ConfigValue{ConfigType::String}.optional()}, - - {"log_rotation_size", ConfigValue{ConfigType::Integer}.defaultValue(2048).withConstraint(gValidateUint32)}, - - {"log_directory_max_size", - ConfigValue{ConfigType::Integer}.defaultValue(50 * 1024).withConstraint(gValidateUint32)}, - - {"log_rotation_hour_interval", ConfigValue{ConfigType::Integer}.defaultValue(12).withConstraint(gValidateUint32)}, - - {"log_tag_style", ConfigValue{ConfigType::String}.defaultValue("none").withConstraint(gValidateLogTag)}, - - {"extractor_threads", ConfigValue{ConfigType::Integer}.defaultValue(1u).withConstraint(gValidateUint32)}, - - {"read_only", ConfigValue{ConfigType::Boolean}.defaultValue(false)}, - - {"start_sequence", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, - - {"finish_sequence", ConfigValue{ConfigType::Integer}.optional().withConstraint(gValidateUint32)}, - - {"ssl_cert_file", ConfigValue{ConfigType::String}.optional()}, - - {"ssl_key_file", ConfigValue{ConfigType::String}.optional()}, - - {"api_version.default", - ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_DEFAULT).withConstraint(gValidateApiVersion)}, - {"api_version.min", - ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_MIN).withConstraint(gValidateApiVersion)}, - {"api_version.max", - ConfigValue{ConfigType::Integer}.defaultValue(rpc::kAPI_VERSION_MAX).withConstraint(gValidateApiVersion)}, - - {"migration.full_scan_threads", ConfigValue{ConfigType::Integer}.defaultValue(2).withConstraint(gValidateUint32)}, - {"migration.full_scan_jobs", ConfigValue{ConfigType::Integer}.defaultValue(4).withConstraint(gValidateUint32)}, - {"migration.cursors_per_job", ConfigValue{ConfigType::Integer}.defaultValue(100).withConstraint(gValidateUint32)}}, -}; +ClioConfigDefinition& +getClioConfig(); } // namespace util::config diff --git a/src/util/config/ConfigDescription.hpp b/src/util/config/ConfigDescription.hpp index 3f14525e..3e7a36e0 100644 --- a/src/util/config/ConfigDescription.hpp +++ b/src/util/config/ConfigDescription.hpp @@ -124,9 +124,9 @@ public: // Every type of value is directed to operator<< in ConfigValue.hpp // as ConfigValue is the one that holds all the info regarding the config values if (key.contains("[]")) { - file << gClioConfig.asArray(key); + file << getClioConfig().asArray(key); } else { - file << gClioConfig.getValueView(key); + file << getClioConfig().getValueView(key); } file << "- **Description**: " << val << "\n"; } diff --git a/tests/unit/app/CliArgsTests.cpp b/tests/unit/app/CliArgsTests.cpp index 5abe8768..3e53824f 100644 --- a/tests/unit/app/CliArgsTests.cpp +++ b/tests/unit/app/CliArgsTests.cpp @@ -220,6 +220,6 @@ TEST_F(CliArgsTestsWithTmpFile, Parse_ConfigDescriptionFileContent) EXPECT_TRUE(fileContent.find("## Configuration Details") != std::string::npos); // all keys that exist in clio config should be listed in config description file - for (auto const& key : gClioConfig) + for (auto const& key : getClioConfig()) EXPECT_TRUE(fileContent.find(key.first)); }