mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-02 00:46:38 +08:00
3f374df724
* fix: 用户编辑时 maxConn 字段未正确回填 - User 接口添加 maxConn 类型定义 - handleEdit 中回填 maxConn 值 - normalizeUserItem 添加 maxConn 字段处理 解决编辑用户时最大连接数显示为 0 的问题 * fix: 保留转发设置并增强节点运行时恢复
33 lines
714 B
Go
33 lines
714 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestReadFileSetsPersistPath(t *testing.T) {
|
|
originalPath := persistPath
|
|
originalEnabled := persistEnable
|
|
persistPath = ""
|
|
persistEnable = false
|
|
t.Cleanup(func() {
|
|
persistPath = originalPath
|
|
persistEnable = originalEnabled
|
|
})
|
|
|
|
dir := t.TempDir()
|
|
configFile := filepath.Join(dir, "custom-gost.yaml")
|
|
if err := os.WriteFile(configFile, []byte("services: []\n"), 0o644); err != nil {
|
|
t.Fatalf("write config file: %v", err)
|
|
}
|
|
|
|
var cfg Config
|
|
if err := cfg.ReadFile(configFile); err != nil {
|
|
t.Fatalf("ReadFile: %v", err)
|
|
}
|
|
if persistPath != configFile {
|
|
t.Fatalf("expected persistPath %q, got %q", configFile, persistPath)
|
|
}
|
|
}
|