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

Function Hub

cmd/crowdsec-cli/core/require/require.go:114–136  ·  view source on GitHub ↗

Hub initializes the hub. If a remote configuration is provided, it can be used to download the index and items. If no remote parameter is provided, the hub can only be used for local operations.

(c *csconfig.Config, logger *logrus.Logger)

Source from the content-addressed store, hash-verified

112// Hub initializes the hub. If a remote configuration is provided, it can be used to download the index and items.
113// If no remote parameter is provided, the hub can only be used for local operations.
114func Hub(c *csconfig.Config, logger *logrus.Logger) (*cwhub.Hub, error) {
115 local := c.Hub
116
117 if local == nil {
118 return nil, errors.New("you must configure cli before interacting with hub")
119 }
120
121 if logger == nil {
122 logger = logrus.New()
123 logger.SetOutput(io.Discard)
124 }
125
126 hub, err := cwhub.NewHub(local, logger)
127 if err != nil {
128 return nil, err
129 }
130
131 if err := hub.Load(); err != nil {
132 return nil, err
133 }
134
135 return hub, nil
136}

Callers 15

newStatusCmdMethod · 0.92
installMethod · 0.92
compAllItemsFunction · 0.92
inspectMethod · 0.92
upgradeMethod · 0.92
listMethod · 0.92
compInstalledItemsFunction · 0.92
removeMethod · 0.92
newEnableCmdMethod · 0.92
dumpMethod · 0.92
newStatusCmdMethod · 0.92
newContextAddCmdMethod · 0.92

Calls 2

LoadMethod · 0.95
NewHubFunction · 0.92

Tested by

no test coverage detected