|
|
@@ -25,9 +25,11 @@ type App struct {
|
|
25
|
25
|
BanThreshold int `mapstructure:"ban-threshold"`
|
|
26
|
26
|
}
|
|
27
|
27
|
type Admin struct {
|
|
28
|
|
- Title string `mapstructure:"title"`
|
|
29
|
|
- Hello string `mapstructure:"hello"`
|
|
30
|
|
- HelloFile string `mapstructure:"hello-file"`
|
|
|
28
|
+ Title string `mapstructure:"title"`
|
|
|
29
|
+ Hello string `mapstructure:"hello"`
|
|
|
30
|
+ HelloFile string `mapstructure:"hello-file"`
|
|
|
31
|
+ IdServerPort int `mapstructure:"id-server-port"`
|
|
|
32
|
+ RelayServerPort int `mapstructure:"relay-server-port"`
|
|
31
|
33
|
}
|
|
32
|
34
|
type Config struct {
|
|
33
|
35
|
Lang string `mapstructure:"lang"`
|
|
|
@@ -46,6 +48,15 @@ type Config struct {
|
|
46
|
48
|
Ldap Ldap
|
|
47
|
49
|
}
|
|
48
|
50
|
|
|
|
51
|
+func (a *Admin) Init() {
|
|
|
52
|
+ if a.IdServerPort == 0 {
|
|
|
53
|
+ a.IdServerPort = DefaultIdServerPort
|
|
|
54
|
+ }
|
|
|
55
|
+ if a.RelayServerPort == 0 {
|
|
|
56
|
+ a.RelayServerPort = DefaultRelayServerPort
|
|
|
57
|
+ }
|
|
|
58
|
+}
|
|
|
59
|
+
|
|
49
|
60
|
// Init 初始化配置
|
|
50
|
61
|
func Init(rowVal *Config, path string) *viper.Viper {
|
|
51
|
62
|
if path == "" {
|
|
|
@@ -80,7 +91,7 @@ func Init(rowVal *Config, path string) *viper.Viper {
|
|
80
|
91
|
panic(fmt.Errorf("Fatal error config: %s \n", err))
|
|
81
|
92
|
}
|
|
82
|
93
|
rowVal.Rustdesk.LoadKeyFile()
|
|
83
|
|
- rowVal.Rustdesk.ParsePort()
|
|
|
94
|
+ rowVal.Admin.Init()
|
|
84
|
95
|
return v
|
|
85
|
96
|
}
|
|
86
|
97
|
|