The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Ixchel::Actions::sagan_merged - Generated a merged base/include for Sagan.

VERSION

Version 0.2.0

CLI SYNOPSIS

ixchel -a sagan_merged [--np] [-w] [-i <instance>]

CODE SYNOPSIS

    use Data::Dumper;

    my $results=$ixchel->action(action=>'sagan_base', opts=>{np=>1, w=>1, });

    print Dumper($results);

DESCRIPTION

.sagan.base_config is used as the URL for the config to use and needs to be something understood by Ixchel::functions::file_get. By default https://raw.githubusercontent.com/quadrantsec/sagan/main/etc/sagan.yaml is used.

The following arrays are blanked in the file.

    .rules-files
    .processors
    .outputs

These are removed as they are array based, making it very awkward to deal with with having them previously defined.

A include is then generated using .sagan.config. If .sagan.multi_instance is set to 1, then .sagan.instances.$instance is merged on top of it using HASH::Merge with RIGHT_PRECEDENT as below with arrays being replaced. This is then generated and merged into the base file file using yq.

.include is set to .sagan.config_base.'/sagan-rules.yaml' in the case of single instance setups if .sagan.multi_instance is set to 1 then .sagan.config_base."/sagan-$instance-rules.yaml"

FLAGS

-w

Write out the configs.

-i instance

A instance to operate on.

RESULT HASH REF

    .errors :: A array of errors encountered.
    .status_text :: A string description of what was done and teh results.
    .ok :: Set to zero if any of the above errored.