mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2025-06-26 01:42:37 +00:00
chore: move db var to savePgsql function
This commit is contained in:
parent
dcb167c10d
commit
f76b70af81
@ -20,6 +20,7 @@ type PsqlConnInfo struct {
|
|||||||
Password string
|
Password string
|
||||||
Schema string
|
Schema string
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPsqlConnInfo() (PsqlConnInfo, error) {
|
func getPsqlConnInfo() (PsqlConnInfo, error) {
|
||||||
var host string
|
var host string
|
||||||
if value := viper.GetString("PGSQL_HOST"); value != "" {
|
if value := viper.GetString("PGSQL_HOST"); value != "" {
|
||||||
@ -107,6 +108,8 @@ func savePgsql(jsonInfo string) {
|
|||||||
exitWithError(err)
|
exitWithError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var db *gorm.DB
|
||||||
|
|
||||||
if PsqlConnInfo.Schema == "" {
|
if PsqlConnInfo.Schema == "" {
|
||||||
db, err = gorm.Open(postgres.Open(PsqlConnInfo.toString()), &gorm.Config{})
|
db, err = gorm.Open(postgres.Open(PsqlConnInfo.toString()), &gorm.Config{})
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user