mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-20 09:29:42 +00:00
fix(config): Error out when no config file supplied
Fixes: #1406 Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
This commit is contained in:
parent
0a901e4f52
commit
32daac3e4d
@ -47,16 +47,6 @@ falco_configuration::~falco_configuration()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have a configuration file, we just use stdout output and all other defaults
|
|
||||||
void falco_configuration::init(list<string> &cmdline_options)
|
|
||||||
{
|
|
||||||
init_cmdline_options(cmdline_options);
|
|
||||||
|
|
||||||
falco::outputs::config stdout_output;
|
|
||||||
stdout_output.name = "stdout";
|
|
||||||
m_outputs.push_back(stdout_output);
|
|
||||||
}
|
|
||||||
|
|
||||||
void falco_configuration::init(string conf_filename, list<string> &cmdline_options)
|
void falco_configuration::init(string conf_filename, list<string> &cmdline_options)
|
||||||
{
|
{
|
||||||
string m_config_file = conf_filename;
|
string m_config_file = conf_filename;
|
||||||
@ -348,4 +338,4 @@ void falco_configuration::set_cmdline_option(const string &opt)
|
|||||||
{
|
{
|
||||||
m_config->set_scalar(keyval.first, keyval.second);
|
m_config->set_scalar(keyval.first, keyval.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,7 +794,7 @@ int falco_init(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conf_filename = "";
|
throw std::invalid_argument("You must create a config file at " FALCO_SOURCE_CONF_FILE ", " FALCO_INSTALL_CONF_FILE " or by passing -c\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,12 +836,7 @@ int falco_init(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
config.init(cmdline_options);
|
throw std::runtime_error("Could not find configuration file at " + conf_filename);
|
||||||
falco_logger::set_time_format_iso_8601(config.m_time_format_iso_8601);
|
|
||||||
|
|
||||||
// log after config init because config determines where logs go
|
|
||||||
falco_logger::log(LOG_INFO, "Falco version " + std::string(FALCO_VERSION) + " (driver version " + std::string(DRIVER_VERSION) + ")\n");
|
|
||||||
falco_logger::log(LOG_INFO, "Falco initialized. No configuration file found, proceeding with defaults\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rules_filenames.size())
|
if (rules_filenames.size())
|
||||||
|
Loading…
Reference in New Issue
Block a user