Repository: AlistGo/alist (language: go)

Issue:
Postgres数据库连接时不支持空密码
### Please make sure of the following things

- [x] I have read the [documentation](https://alist.nn.ci).
我已经阅读了[文档](https://alist.nn.ci)。

- [x] I'm sure there are no duplicate issues or discussions.
我确定没有重复的issue或讨论。

- [x] I'm sure it's due to `AList` and not something else(such as [Network](https://alist.nn.ci/faq/howto.html#tls-handshake-timeout-read-connection-reset-by-peer-dns-lookup-failed-connect-connection-refused-client-timeout-exceeded-while-awaiting-headers-no-such-host) ,`Dependencies` or `Operational`).
我确定是`AList`的问题，而不是其他原因（例如[网络](https://alist.nn.ci/zh/faq/howto.html#tls-handshake-timeout-read-connection-reset-by-peer-dns-lookup-failed-connect-connection-refused-client-timeout-exceeded-while-awaiting-headers-no-such-host)，`依赖`或`操作`）。

- [x] I'm sure this issue is not fixed in the latest version.
我确定这个问题在最新版本中没有被修复。


### AList Version / AList 版本

v3.42.0/docker:main-aio

### Driver used / 使用的存储驱动

*

### Describe the bug / 问题描述

关联issue: #5168,#4133

在个人配置没有设置密码的情况下，alist会忽视`database.name`项配置，数据库表均生成在`postgres/public`下, 也就是当前用户下
在内网使用时, postgres可以通过hba.conf设置内网ip段为trust, 从而无需密码连接。
这是一个很正常的使用场景，希望修复。

附上临时的解决方案: password处不为空即可, 个人测试`@`可以正常使用

### Reproduction / 复现链接

暂无

### Config / 配置

  ```
"database": {
    "type": "postgres",
    "host": "postgres",
    "port": 5432,
    "user": "postgres",
    "password": "",
    "name": "alist",
    "table_prefix": "x_",
    "ssl_mode": "disable"
  }
```

### Logs / 日志

_No response_


Discussion / hints:
临时解决方案还可以直接写DSN应该
https://github.com/AlistGo/alist/blob/main/internal/bootstrap/db.go#L69

Fix patch:
diff --git a/internal/bootstrap/db.go b/internal/bootstrap/db.go
index 39b659b78f1..5f5f6fcef3e 100644
--- a/internal/bootstrap/db.go
+++ b/internal/bootstrap/db.go
@@ -68,8 +68,13 @@ func InitDB() {
 			{
 				dsn := database.DSN
 				if dsn == "" {
-					dsn = fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=Asia/Shanghai",
-						database.Host, database.User, database.Password, database.Name, database.Port, database.SSLMode)
+					if database.Password != "" {
+						dsn = fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=Asia/Shanghai",
+							database.Host, database.User, database.Password, database.Name, database.Port, database.SSLMode)
+					} else {
+						dsn = fmt.Sprintf("host=%s user=%s dbname=%s port=%d sslmode=%s TimeZone=Asia/Shanghai",
+							database.Host, database.User, database.Name, database.Port, database.SSLMode)
+					}
 				}
 				dB, err = gorm.Open(postgres.Open(dsn), gormConfig)
 			}


Test patch: