From 73ec593931165f23f4cf3c912f7bc321123e13b9 Mon Sep 17 00:00:00 2001 From: Henri DF Date: Tue, 12 Apr 2016 16:00:56 -0700 Subject: [PATCH] Add a configuration::init() that just sets up defaults (For when no config file is being used) --- userspace/digwatch/configuration.cpp | 11 ++++++++++- userspace/digwatch/configuration.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/userspace/digwatch/configuration.cpp b/userspace/digwatch/configuration.cpp index 1835116f..401d6328 100644 --- a/userspace/digwatch/configuration.cpp +++ b/userspace/digwatch/configuration.cpp @@ -4,9 +4,18 @@ using namespace std; + +// If we don't have a configuration file, we just use stdout output and all other defaults void digwatch_configuration::init() { - string m_config_file = DIGWATCH_CONF_FILE; + output_config stdout_output; + stdout_output.name = "stdout"; + m_outputs.push_back(stdout_output); +} + +void digwatch_configuration::init(string conf_filename) +{ + string m_config_file = conf_filename; m_config = new yaml_configuration(m_config_file); m_rules_file = m_config->get_scalar("rules_file", "/etc/digwatch.conf"); diff --git a/userspace/digwatch/configuration.h b/userspace/digwatch/configuration.h index d709ffa5..9d3644ab 100644 --- a/userspace/digwatch/configuration.h +++ b/userspace/digwatch/configuration.h @@ -92,6 +92,7 @@ private: class digwatch_configuration { public: + void init(std::string conf_filename); void init(); std::string m_rules_file; std::string m_priority_level;