mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-25 17:38:53 +00:00
new(falco): enable -o key={object} configuration
Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
parent
24a70da976
commit
5b6810a51e
@ -84,8 +84,8 @@ falco_configuration::falco_configuration():
|
|||||||
m_metrics_convert_memory_to_mb(true),
|
m_metrics_convert_memory_to_mb(true),
|
||||||
m_metrics_include_empty_values(false),
|
m_metrics_include_empty_values(false),
|
||||||
m_container_engines_mask(0),
|
m_container_engines_mask(0),
|
||||||
m_container_engines_cri_socket_paths({"/run/containerd/containerd.sock", "/run/crio/crio.sock","/run/k3s/containerd/containerd.sock"}),
|
m_container_engines_disable_cri_async(false),
|
||||||
m_container_engines_disable_cri_async(false)
|
m_container_engines_cri_socket_paths({"/run/containerd/containerd.sock", "/run/crio/crio.sock","/run/k3s/containerd/containerd.sock"})
|
||||||
{
|
{
|
||||||
m_config_schema = nlohmann::json::parse(schema_json_string);
|
m_config_schema = nlohmann::json::parse(schema_json_string);
|
||||||
}
|
}
|
||||||
@ -749,5 +749,12 @@ void falco_configuration::set_cmdline_option(const std::string &opt)
|
|||||||
throw std::logic_error("Error parsing config option \"" + opt + "\". Must be of the form key=val or key.subkey=val");
|
throw std::logic_error("Error parsing config option \"" + opt + "\". Must be of the form key=val or key.subkey=val");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keyval.second[0] == '{' && keyval.second[keyval.second.size() - 1] == '}')
|
||||||
|
{
|
||||||
|
YAML::Node node = YAML::Load(keyval.second);
|
||||||
|
m_config.set_object(keyval.first, node);
|
||||||
|
} else
|
||||||
|
{
|
||||||
m_config.set_scalar(keyval.first, keyval.second);
|
m_config.set_scalar(keyval.first, keyval.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,16 @@ public:
|
|||||||
node = value;
|
node = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the node identified by key to an object value
|
||||||
|
*/
|
||||||
|
void set_object(const std::string& key, const YAML::Node& value)
|
||||||
|
{
|
||||||
|
YAML::Node node;
|
||||||
|
get_node(node, key, true);
|
||||||
|
node = value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the sequence value from the node identified by key.
|
* Get the sequence value from the node identified by key.
|
||||||
*/
|
*/
|
||||||
@ -482,5 +492,6 @@ namespace YAML {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// The "encode" function is not needed here, in fact you can simply YAML::load any json string.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user