( cscfg *csconfig.CrowdsecServiceCfg, hub *cwhub.Hub, scenarios []*cwhub.Item, orderEvent bool, )
| 182 | } |
| 183 | |
| 184 | func LoadBuckets( |
| 185 | cscfg *csconfig.CrowdsecServiceCfg, |
| 186 | hub *cwhub.Hub, |
| 187 | scenarios []*cwhub.Item, |
| 188 | orderEvent bool, |
| 189 | ) ([]BucketFactory, chan pipeline.Event, error) { |
| 190 | allFactories := []BucketFactory{} |
| 191 | response := make(chan pipeline.Event, 1) |
| 192 | |
| 193 | for _, item := range scenarios { |
| 194 | log.Debugf("Loading '%s'", item.State.LocalPath) |
| 195 | |
| 196 | factories, err := loadBucketFactoriesFromFile(item, hub, response, orderEvent, &cscfg.SimulationConfig) |
| 197 | if err != nil { |
| 198 | return nil, nil, err |
| 199 | } |
| 200 | |
| 201 | allFactories = append(allFactories, factories...) |
| 202 | } |
| 203 | |
| 204 | if err := alertcontext.NewAlertContext(cscfg.ContextToSend, cscfg.ConsoleContextValueLength); err != nil { |
| 205 | return nil, nil, fmt.Errorf("unable to load alert context: %w", err) |
| 206 | } |
| 207 | |
| 208 | log.Infof("Loaded %d scenarios", len(allFactories)) |
| 209 | |
| 210 | return allFactories, response, nil |
| 211 | } |
| 212 | |
| 213 | func bucketLogger(f *BucketFactory) *log.Entry { |
| 214 | fields := log.Fields{"cfg": f.BucketName, "name": f.Spec.Name} |
searching dependent graphs…