MCPcopy
hub / github.com/crowdsecurity/crowdsec / initDataFiles

Method initDataFiles

pkg/leakybucket/manager_load.go:335–352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

333}
334
335func (f *BucketFactory) initDataFiles() {
336 for _, data := range f.Spec.Data {
337 if data.DestPath == "" {
338 f.logger.Errorf("no dest_file provided for '%s'", f.Spec.Name)
339 continue
340 }
341
342 if err := exprhelpers.FileInit(f.DataDir, data.DestPath, data.Type); err != nil {
343 f.logger.Errorf("unable to init data for file '%s': %s", data.DestPath, err)
344 }
345
346 if data.Type == "regexp" { // cache only makes sense for regexp
347 if err := exprhelpers.RegexpCacheInit(data.DestPath, *data); err != nil {
348 f.logger.Error(err.Error())
349 }
350 }
351 }
352}
353
354// LoadBucket validates and prepares a BucketFactory for runtime use (compile expressions, init processors, init data).
355func (f *BucketFactory) LoadBucket() error {

Callers 1

LoadBucketMethod · 0.95

Calls 3

FileInitFunction · 0.92
RegexpCacheInitFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected