简化API节点的数据库配置(db.yaml)

This commit is contained in:
GoEdgeLab
2024-05-06 17:29:11 +08:00
parent d8e9268dab
commit a573eb5608
8 changed files with 223 additions and 91 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/iwind/TeaGo/dbs"
"github.com/iwind/TeaGo/maps"
"net"
"net/url"
"os"
"runtime"
"strings"
@@ -48,7 +49,7 @@ func (this *DetectDBAction) RunPost(params struct{}) {
for _, pass := range passwords {
db, err := dbs.NewInstanceFromConfig(&dbs.DBConfig{
Driver: "mysql",
Dsn: username + ":" + pass + "@tcp(" + configutils.QuoteIP(localHost) + ":" + localPort + ")/edges",
Dsn: url.QueryEscape(username) + ":" + url.QueryEscape(pass) + "@tcp(" + configutils.QuoteIP(localHost) + ":" + localPort + ")/edges",
Prefix: "",
})
if err == nil {