| 566 | } |
| 567 | |
| 568 | func (wc *AppsecConfig) Load(configName string, hub *cwhub.Hub) error { |
| 569 | item := hub.GetItem(cwhub.APPSEC_CONFIGS, configName) |
| 570 | |
| 571 | if item != nil && item.State.IsInstalled() { |
| 572 | wc.Logger.Infof("loading %s", item.State.LocalPath) |
| 573 | |
| 574 | err := wc.LoadByPath(item.State.LocalPath) |
| 575 | if err != nil { |
| 576 | return fmt.Errorf("unable to load appsec-config %s : %s", item.State.LocalPath, err) |
| 577 | } |
| 578 | |
| 579 | return nil |
| 580 | } |
| 581 | |
| 582 | return fmt.Errorf("no appsec-config found for %s", configName) |
| 583 | } |
| 584 | |
| 585 | func (wc *AppsecConfig) Build(ctx context.Context, hub *cwhub.Hub) (*AppsecRuntimeConfig, error) { |
| 586 | ret := &AppsecRuntimeConfig{Logger: wc.Logger.WithField("component", "appsec_runtime_config")} |