feat: improve datasource query audit workflows
This commit is contained in:
1 parent
74748e4914
commit
644981eef4
32 files changed
+780
-3061
No files matched your search
@@ -117,7 +117,7 @@ func testPostgreSQL(ctx context.Context, host string, port int, user, pass, dbna
|
||||
dbname = "postgres"
|
||||
}
|
||||
dsn := fmt.Sprintf("postgres://%s:***@%s:%d/%s?sslmode=disable&connect_timeout=10",
|
||||
user, pass, host, port, dbname)
|
||||
user, host, port, dbname)
|
||||
db, err := sql.Open("pgx", dsn)
|
||||
if err != nil {
|
||||
return false, fmt.Sprintf("Connection failed: %v", err)
|
||||
@@ -141,12 +141,12 @@ func testRedis(ctx context.Context, host string, port int, username, pass string
|
||||
redisUsername = ""
|
||||
}
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: addr,
|
||||
Username: redisUsername,
|
||||
Password: pass,
|
||||
DB: 0,
|
||||
DialTimeout: 10 * time.Second,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
Addr: addr,
|
||||
Username: redisUsername,
|
||||
Password: pass,
|
||||
DB: 0,
|
||||
DialTimeout: 10 * time.Second,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
})
|
||||
defer rdb.Close()
|
||||
|
||||
@@ -541,7 +541,7 @@ func getDBConnection(instance *model.Instance, dbName string) (*sql.DB, error) {
|
||||
dbName = "postgres"
|
||||
}
|
||||
dsn := fmt.Sprintf("postgres://%s:***@%s:%d/%s?sslmode=disable&connect_timeout=10",
|
||||
instance.Username, password, instance.Host, instance.Port, dbName)
|
||||
instance.Username, instance.Host, instance.Port, dbName)
|
||||
return sql.Open("pgx", dsn)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported database type: %s", instance.DBType)
|
||||
|
||||
Reference in new issue
Block a user