RSC
0.13.4
|
Objects of this class analyze the environment of the current process, finding environment variables whose name starts with a specified string. More...
#include <Environment.h>
Public Member Functions | |
EnvironmentVariableSource (const std::string &prefix="", const bool &stripPrefix=true) | |
Construct a source that collect environment variables whose name starts with prefix. More... | |
void | provideOptions (OptionHandler &handler) |
Implementations should pass all configuration options to handler. More... | |
Public Member Functions inherited from rsc::config::ConfigSource | |
virtual | ~ConfigSource () |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
const std::string | prefix |
bool | stripPrefix |
Additional Inherited Members | |
Protected Member Functions inherited from rsc::config::ConfigSource | |
void | splitKeyAtDots (const std::string &input, std::vector< std::string > &output) |
Creates a key vector structure used in the options backend from a dot-separated string. More... | |
Objects of this class analyze the environment of the current process, finding environment variables whose name starts with a specified string.
The prefix is stripped from matching names and the variables are converted to options and passed to the OptionHandler.
Definition at line 102 of file Environment.h.
rsc::config::EnvironmentVariableSource::EnvironmentVariableSource | ( | const std::string & | prefix = "" , |
const bool & | stripPrefix = true |
||
) |
Construct a source that collect environment variables whose name starts with prefix.
prefix | A prefix string against which all environment variables are matched. |
stripPrefix | Determines whether the specified prefix will be stripped from the options when passing them to the handlers or not. If e.g. RSC_ is set as prefix and this is true, RSC_TEST will be passed to the handlers as just TEST. Default is true. |
Definition at line 119 of file Environment.cpp.
|
virtual |
Implementations should pass all configuration options to handler.
handler | The handler to which all option should be passed. |
std::invalid_argument | may be thrown when the options this source uses in the background are not well-formated |
Implements rsc::config::ConfigSource.
Definition at line 125 of file Environment.cpp.
References rsc::config::OptionHandler::handleOption(), logger, RSCTRACE, and rsc::config::transformName().
Referenced by rsc::config::configure().
|
private |
Definition at line 121 of file Environment.h.
Referenced by provideOptions().
|
private |
Definition at line 123 of file Environment.h.
|
private |
Definition at line 124 of file Environment.h.