cscli: avoid initializing the db configuration twice (#1982)
This commit is contained in:
parent
ca12432a2a
commit
c4deaf0994
4 changed files with 0 additions and 13 deletions
|
@ -443,9 +443,6 @@ cscli alerts delete -s crowdsecurity/ssh-bf"`,
|
|||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to create new database client: %s", err)
|
||||
|
|
|
@ -206,9 +206,6 @@ Note: This command requires database direct access, so is intended to be run on
|
|||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to create new database client: %s", err)
|
||||
|
|
|
@ -407,10 +407,6 @@ Note: This command requires database direct access, so is intended to be run on
|
|||
}
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Errorf("This command requires direct database access (must be run on the local API machine)")
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -739,9 +739,6 @@ func getDBClient() (*database.Client, error) {
|
|||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
return nil, err
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret, err := database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue