Skip to content

Commit

Permalink
Multiple config files are not supported
Browse files Browse the repository at this point in the history
Problem
-------

OpenDDS currently supports a single configuration file.  Supporting
multiple configuration files would allow complex configurations to be
broken down into more modular configuration files and it allows "base"
configuration to be customized.

Solution
--------

Add a command-line argument named `-DCPSSingleConfigFile 0` to turn on
support for multiple config files.  For backwards compatibility, the
default is `-DCPSSingleConfigFile 0`.  When multiple config files are
enabled, process command-line arguments in order and process each
configuration file as it is encountered.  Multiple configuration files
are supported via multiple `-DCPSConfigFile` arguments.

Configuration now processes environment variables first and then
command-line arguments in order.  Each config file is processed as it
is encounter in the command-line.
  • Loading branch information
jrw972 committed Mar 8, 2024
1 parent 19abd11 commit f96bb4c
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 189 deletions.
6 changes: 1 addition & 5 deletions dds/DCPS/ConfigStoreImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,6 @@ process_section(ConfigStoreImpl& config_store,
const String& key_prefix,
ACE_Configuration_Heap& config,
const ACE_Configuration_Section_Key& base,
const String& filename,
bool allow_overwrite)
{
// Process the values.
Expand All @@ -1077,9 +1076,6 @@ process_section(ConfigStoreImpl& config_store,
if (config.get_string_value(base, key.c_str(), value) == 0) {
const String key_name = key_prefix + "_" + ACE_TEXT_ALWAYS_CHAR(key.c_str());
String value_str = ACE_TEXT_ALWAYS_CHAR(value.c_str());
if (value_str == "$file") {
value_str = filename;
}
if (allow_overwrite || !config_store.has(key_name.c_str())) {
config_store.set(key_name.c_str(), value_str);
if (listener && reader) {
Expand Down Expand Up @@ -1125,7 +1121,7 @@ process_section(ConfigStoreImpl& config_store,
if (status == 0) {
ACE_Configuration_Section_Key key;
if (config.open_section(base, section_name.c_str(), 0, key) == 0) {
process_section(config_store, reader, listener, next_key_prefix, config, key, filename, allow_overwrite);
process_section(config_store, reader, listener, next_key_prefix, config, key, allow_overwrite);
} else {
if (log_level >= LogLevel::Error) {
ACE_ERROR((LM_ERROR,
Expand Down
1 change: 0 additions & 1 deletion dds/DCPS/ConfigStoreImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ process_section(ConfigStoreImpl& config_store,
const String& key_prefix,
ACE_Configuration_Heap& config,
const ACE_Configuration_Section_Key& base,
const String& filename,
bool allow_overwrite);

} // namespace DCPS
Expand Down
Loading

0 comments on commit f96bb4c

Please sign in to comment.