Files
Wormhole/internal/config/config_test.go
T
rose_cat707 612d68f56f feat: Wormhole 内网穿透与反向代理网关
Go + Vue 管理台,SQLite 持久化;支持隧道/域名穿透、域名转发插件链、访客认证、
IP 规则、API Key、Docker 单镜像部署;配置通过 Web 系统设置管理,无需 YAML 文件。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 12:15:02 +08:00

34 lines
636 B
Go

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)
}
}