mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-20 22:54:45 +08:00
Merge pull request #1077 from Clov614/main
fix(auto setup): 修复初始测试连接硬编码问题导致使用自定义数据库测试失败无法执行 auto setup流程
This commit is contained in:
@@ -164,8 +164,8 @@ func NeedsSetup() bool {
|
|||||||
func TestDatabaseConnection(cfg *DatabaseConfig) error {
|
func TestDatabaseConnection(cfg *DatabaseConfig) error {
|
||||||
// First, connect to the default 'postgres' database to check/create target database
|
// First, connect to the default 'postgres' database to check/create target database
|
||||||
defaultDSN := fmt.Sprintf(
|
defaultDSN := fmt.Sprintf(
|
||||||
"host=%s port=%d user=%s password=%s dbname=postgres sslmode=%s",
|
"host=%s port=%d user=%s password=%s dbname=%s sslmode=%s",
|
||||||
cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.SSLMode,
|
cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.DBName, cfg.SSLMode,
|
||||||
)
|
)
|
||||||
|
|
||||||
db, err := sql.Open("postgres", defaultDSN)
|
db, err := sql.Open("postgres", defaultDSN)
|
||||||
|
|||||||
Reference in New Issue
Block a user