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

Function DBClient

cmd/crowdsec-cli/core/require/require.go:83–94  ·  view source on GitHub ↗
(ctx context.Context, dbcfg *csconfig.DatabaseCfg)

Source from the content-addressed store, hash-verified

81}
82
83func DBClient(ctx context.Context, dbcfg *csconfig.DatabaseCfg) (*database.Client, error) {
84 if dbcfg == nil {
85 return nil, errors.New("no database configuration provided")
86 }
87
88 db, err := database.NewClient(ctx, dbcfg, dbcfg.NewLogger())
89 if err != nil {
90 return nil, fmt.Errorf("failed to connect to database: %w", err)
91 }
92
93 return db, nil
94}
95
96func HubDownloader(ctx context.Context, c *csconfig.Config) (*cwhub.Downloader, error) {
97 // set branch in config, and log if necessary

Callers 15

newStatusCmdMethod · 0.92
newFlushCmdMethod · 0.92
newStatusCmdMethod · 0.92
newSyncCmdMethod · 0.92
showMethod · 0.92
dumpMethod · 0.92
NewCommandMethod · 0.92
validBouncerIDMethod · 0.92
NewCommandMethod · 0.92
validMachineIDMethod · 0.92
validAllowlistsMethod · 0.92

Calls 2

NewClientFunction · 0.92
NewLoggerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…