pub fn merge(self, mut raw: RawConfig) -> RawConfig {
        if self.host.is_some() {
            raw.http.host = self.host;
        }

        if self.endpoint_path.is_some() {
            raw.http.endpoint = self.endpoint_path;
        }

        if self.key.is_some() {
            raw.http.ingestion_key = self.key;
        }

        if self.use_ssl.is_some() {
            raw.http.use_ssl = self.use_ssl;
        }

        if self.use_compression.is_some() {
            raw.http.use_compression = self.use_compression;
        }

        if self.gzip_level.is_some() {
            raw.http.gzip_level = self.gzip_level;
        }

        let mut params = match raw.http.params {
            Some(v) => v,
            None => Params {
                hostname: "".to_string(),
                mac: None,
                ip: None,
                now: 0,
                tags: None,
            },
        };

        if let Some(v) = self.os_hostname {
            params.hostname = v;
        }

        if self.ip.is_some() {
            params.ip = self.ip;
        }

        if self.mac.is_some() {
            params.mac = self.mac;
        }

        if !self.tags.is_empty() {
            let tags = params.tags.get_or_insert(Tags::new());
            with_csv(self.tags).iter().for_each(|v| {
                tags.add(v);
            });
        }

        raw.http.params = Some(params);

        if self.ingest_timeout.is_some() {
            raw.http.timeout = self.ingest_timeout;
        }

        if self.ingest_buffer_size.is_some() {
            raw.http.body_size = self.ingest_buffer_size;
        }

        if !self.log_dirs.is_empty() {
            with_csv(self.log_dirs)
                .iter()
                .for_each(|v| raw.log.dirs.push(PathBuf::from(v)));
        }

        if let Some(ref p) = self.db_path {
            raw.log.db_path = Some(p.into())
        }

        if let Some(port) = self.metrics_port {
            raw.log.metrics_port = Some(port)
        }

        set_rules(
            &mut raw.log.exclude,
            self.exclusion_rules,
            self.exclusion_regex,
        );
        set_rules(
            &mut raw.log.include,
            self.inclusion_rules,
            self.inclusion_regex,
        );

        if !self.journald_paths.is_empty() {
            let paths = raw.journald.paths.get_or_insert(Vec::new());
            with_csv(self.journald_paths)
                .iter()
                .for_each(|v| paths.push(PathBuf::from(v)));
        }

        if self.lookback.is_some() {
            raw.log.lookback = self.lookback.map(|v| v.to_string());
        }

        if self.use_k8s_enrichment.is_some() {
            raw.log.use_k8s_enrichment = self.use_k8s_enrichment.map(|v| v.to_string());
        }

        if self.log_k8s_events.is_some() {
            raw.log.log_k8s_events = self.log_k8s_events.map(|v| v.to_string());
        }

        if self.db_path.is_some() {
            raw.log.db_path = self.db_path.map(PathBuf::from);
        }

        if !self.line_exclusion.is_empty() {
            let regex = raw.log.line_exclusion_regex.get_or_insert(Vec::new());
            with_csv(self.line_exclusion)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }

        if !self.line_inclusion.is_empty() {
            let regex = raw.log.line_inclusion_regex.get_or_insert(Vec::new());
            with_csv(self.line_inclusion)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }

        if !self.line_redact.is_empty() {
            let regex = raw.log.line_redact_regex.get_or_insert(Vec::new());
            with_csv(self.line_redact)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }

        raw
    }
/// Overrides the `RawConfig` (yaml config) with the values that were defined via
/// command line options or environment variables.
Overrides the `RawConfig` (yaml config) with the values that were defined via
command line options or environment variables.
Overrides the ` RawConfig ` ( yaml config ) with the values that were defined via command line options or environment variables .
pub fn merge(self, mut raw: RawConfig) -> RawConfig {
        if self.host.is_some() {
            raw.http.host = self.host;
        }
        if self.endpoint_path.is_some() {
            raw.http.endpoint = self.endpoint_path;
        }
        if self.key.is_some() {
            raw.http.ingestion_key = self.key;
        }
        if self.use_ssl.is_some() {
            raw.http.use_ssl = self.use_ssl;
        }
        if self.use_compression.is_some() {
            raw.http.use_compression = self.use_compression;
        }
        if self.gzip_level.is_some() {
            raw.http.gzip_level = self.gzip_level;
        }
        let mut params = match raw.http.params {
            Some(v) => v,
            None => Params {
                hostname: "".to_string(),
                mac: None,
                ip: None,
                now: 0,
                tags: None,
            },
        };
        if let Some(v) = self.os_hostname {
            params.hostname = v;
        }
        if self.ip.is_some() {
            params.ip = self.ip;
        }
        if self.mac.is_some() {
            params.mac = self.mac;
        }
        if !self.tags.is_empty() {
            let tags = params.tags.get_or_insert(Tags::new());
            with_csv(self.tags).iter().for_each(|v| {
                tags.add(v);
            });
        }
        raw.http.params = Some(params);
        if self.ingest_timeout.is_some() {
            raw.http.timeout = self.ingest_timeout;
        }
        if self.ingest_buffer_size.is_some() {
            raw.http.body_size = self.ingest_buffer_size;
        }
        if !self.log_dirs.is_empty() {
            with_csv(self.log_dirs)
                .iter()
                .for_each(|v| raw.log.dirs.push(PathBuf::from(v)));
        }
        if let Some(ref p) = self.db_path {
            raw.log.db_path = Some(p.into())
        }
        if let Some(port) = self.metrics_port {
            raw.log.metrics_port = Some(port)
        }
        set_rules(
            &mut raw.log.exclude,
            self.exclusion_rules,
            self.exclusion_regex,
        );
        set_rules(
            &mut raw.log.include,
            self.inclusion_rules,
            self.inclusion_regex,
        );
        if !self.journald_paths.is_empty() {
            let paths = raw.journald.paths.get_or_insert(Vec::new());
            with_csv(self.journald_paths)
                .iter()
                .for_each(|v| paths.push(PathBuf::from(v)));
        }
        if self.lookback.is_some() {
            raw.log.lookback = self.lookback.map(|v| v.to_string());
        }
        if self.use_k8s_enrichment.is_some() {
            raw.log.use_k8s_enrichment = self.use_k8s_enrichment.map(|v| v.to_string());
        }
        if self.log_k8s_events.is_some() {
            raw.log.log_k8s_events = self.log_k8s_events.map(|v| v.to_string());
        }
        if self.db_path.is_some() {
            raw.log.db_path = self.db_path.map(PathBuf::from);
        }
        if !self.line_exclusion.is_empty() {
            let regex = raw.log.line_exclusion_regex.get_or_insert(Vec::new());
            with_csv(self.line_exclusion)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }
        if !self.line_inclusion.is_empty() {
            let regex = raw.log.line_inclusion_regex.get_or_insert(Vec::new());
            with_csv(self.line_inclusion)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }
        if !self.line_redact.is_empty() {
            let regex = raw.log.line_redact_regex.get_or_insert(Vec::new());
            with_csv(self.line_redact)
                .iter()
                .for_each(|v| regex.push(v.clone()));
        }
        raw
    }
pub fn merge ( self , mut raw : RawConfig ) -> RawConfig { if self . host . is_some ( ) { raw . http . host = self . host ; } if self . endpoint_path . is_some ( ) { raw . http . endpoint = self . endpoint_path ; } if self . key . is_some ( ) { raw . http . ingestion_key = self . key ; } if self . use_ssl . is_some ( ) { raw . http . use_ssl = self . use_ssl ; } if self . use_compression . is_some ( ) { raw . http . use_compression = self . use_compression ; } if self . gzip_level . is_some ( ) { raw . http . gzip_level = self . gzip_level ; } let mut params = match raw . http . params { Some ( v ) => v , None => Params { hostname : " " . to_string ( ) , mac : None , ip : None , now : 0 , tags : None , } , } ; if let Some ( v ) = self . os_hostname { params . hostname = v ; } if self . ip . is_some ( ) { params . ip = self . ip ; } if self . mac . is_some ( ) { params . mac = self . mac ; } if ! self . tags . is_empty ( ) { let tags = params . tags . get_or_insert ( Tags :: new ( ) ) ; with_csv ( self . tags ) . iter ( ) . for_each ( | v | { tags . add ( v ) ; } ) ; } raw . http . params = Some ( params ) ; if self . ingest_timeout . is_some ( ) { raw . http . timeout = self . ingest_timeout ; } if self . ingest_buffer_size . is_some ( ) { raw . http . body_size = self . ingest_buffer_size ; } if ! self . log_dirs . is_empty ( ) { with_csv ( self . log_dirs ) . iter ( ) . for_each ( | v | raw . log . dirs . push ( PathBuf :: from ( v ) ) ) ; } if let Some ( ref p ) = self . db_path { raw . log . db_path = Some ( p . into ( ) ) } if let Some ( port ) = self . metrics_port { raw . log . metrics_port = Some ( port ) } set_rules ( & mut raw . log . exclude , self . exclusion_rules , self . exclusion_regex , ) ; set_rules ( & mut raw . log . include , self . inclusion_rules , self . inclusion_regex , ) ; if ! self . journald_paths . is_empty ( ) { let paths = raw . journald . paths . get_or_insert ( Vec :: new ( ) ) ; with_csv ( self . journald_paths ) . iter ( ) . for_each ( | v | paths . push ( PathBuf :: from ( v ) ) ) ; } if self . lookback . is_some ( ) { raw . log . lookback = self . lookback . map ( | v | v . to_string ( ) ) ; } if self . use_k8s_enrichment . is_some ( ) { raw . log . use_k8s_enrichment = self . use_k8s_enrichment . map ( | v | v . to_string ( ) ) ; } if self . log_k8s_events . is_some ( ) { raw . log . log_k8s_events = self . log_k8s_events . map ( | v | v . to_string ( ) ) ; } if self . db_path . is_some ( ) { raw . log . db_path = self . db_path . map ( PathBuf :: from ) ; } if ! self . line_exclusion . is_empty ( ) { let regex = raw . log . line_exclusion_regex . get_or_insert ( Vec :: new ( ) ) ; with_csv ( self . line_exclusion ) . iter ( ) . for_each ( | v | regex . push ( v . clone ( ) ) ) ; } if ! self . line_inclusion . is_empty ( ) { let regex = raw . log . line_inclusion_regex . get_or_insert ( Vec :: new ( ) ) ; with_csv ( self . line_inclusion ) . iter ( ) . for_each ( | v | regex . push ( v . clone ( ) ) ) ; } if ! self . line_redact . is_empty ( ) { let regex = raw . log . line_redact_regex . get_or_insert ( Vec :: new ( ) ) ; with_csv ( self . line_redact ) . iter ( ) . for_each ( | v | regex . push ( v . clone ( ) ) ) ; } raw }
Overrides the `RawConfig` (yaml config) with the values that were defined via
command line options or environment variables.
Overrides the ` RawConfig ` ( yaml config ) with the values that were defined via command line options or environment variables .
self
raw
RawConfig
self
raw
RawConfig