Go + Vue 管理台:Agent 隧道、域名反代、IP 安全、访客验证与监控大盘。 Gitea Actions CI 多架构镜像;纯 Go SQLite、无 CGO Docker 构建。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoadUsesFileValues(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
cfgPath := filepath.Join(dir, "wormhole.yaml")
|
||||
content := []byte(`server:
|
||||
bridge_addr: ":9528"
|
||||
http_addr: ":9529"
|
||||
database:
|
||||
path: "./tmp.db"
|
||||
auth:
|
||||
jwt_secret: "test-secret"
|
||||
token_ttl: 1h
|
||||
metrics:
|
||||
flush_interval: 10s
|
||||
`)
|
||||
if err := os.WriteFile(cfgPath, content, 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg, err := Load(cfgPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Server.BridgeAddr != ":9528" || cfg.Server.HTTPAddr != ":9529" {
|
||||
t.Fatalf("server config not applied: %+v", cfg.Server)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user