-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent will operate with its default configuration out of the box #304
Conversation
3d9a378
to
5b8ca1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the choice of interface for the default value, we are passing it all the way down to the configuration parser only to get it back if it can't find the requested key.
There's a similar end user case that you could achieve by changing the returned type to an optional, see https://en.cppreference.com/w/cpp/utility/optional/value_or .
Instead of T GetConfig(T defaultValue, Keys... keys) const
and passing the default value all the way down, you can do std::optional<T> GetConfig(Keys... keys)
and when used configurationParser.GetConfig<int>("table", "key").value_or(DEFAULT_VALUE_FOR_KEY)
.
src/agent/configuration_parser/tests/configuration_parser_test.cpp
Outdated
Show resolved
Hide resolved
5b8ca1f
to
c9a3b11
Compare
src/agent/configuration_parser/include/configuration_parser.hpp
Outdated
Show resolved
Hide resolved
src/agent/configuration_parser/tests/configuration_parser_test.cpp
Outdated
Show resolved
Hide resolved
constexpr auto DEFAULT_RELOAD_INTERVAL = @DEFAULT_RELOAD_INTERVAL@; | ||
namespace logcollector | ||
{ | ||
constexpr auto BUFFER_SIZE = @BUFFER_SIZE@; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: In the future we need to evaluate if this setting should also be included in the wazuh-agent.yml
file.
168cca8
to
b5c3682
Compare
Also corresponding changes in agent.cpp and CMakeLists.txt
b5c3682
to
c53ec86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR aims to allow the agent to use default settings in case some or all settings are not specified in the configuration file or if the configuration file does not exist.
Configuration options
Logs/Alerts example
Tests