Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
78 lines (62 sloc) 1.92 KB
##! File input for the configuration framework using the input framework.
@load ./main
@load base/frameworks/cluster
module Config;
export {
## Configuration files that will be read off disk. Files are reread
## every time they are updated so updates should be atomic with "mv"
## instead of writing the file in place.
## If the same configuration option is defined in several files with
## different values, behavior is unspecified.
const config_files: set[string] = {} &redef;
## Read specified configuration file and apply values; updates to file
## are not tracked.
global read_config: function(filename: string);
global current_config: table[string] of string = table();
type ConfigItem: record {
option_nv: string;
type EventFields: record {
option_name: string;
option_val: string;
event config_line(description: Input::EventDescription, tpe: Input::Event, p: EventFields)
event bro_init() &priority=5
if ( Cluster::is_enabled() && Cluster::local_node_type() != Cluster::MANAGER )
for ( fi in config_files )
$name=cat("config-", fi),
event InputConfig::new_value(name: string, source: string, id: string, value: any)
if ( sub_bytes(name, 1, 15) != "config-oneshot-" && source !in config_files )
Config::set_value(id, value, source);
function read_config(filename: string)
# Only read the configuration on the manager. The other nodes are being fed
# from the manager.
if ( Cluster::is_enabled() && Cluster::local_node_type() != Cluster::MANAGER )
local iname = cat("config-oneshot-", filename);