Pass server configuration as an argument

The ServerCommonConf is now passed around as an argument instead of
being shared between components as a global variable. This allows for
more natural interaction with server.Session as a library and allows for
multiple servers to co-exist within the same process.

Related: #1387
This commit is contained in:
Tyler Compton
2019-08-19 11:07:37 -07:00
parent a415573e45
commit 6277af4790
14 changed files with 117 additions and 146 deletions

10
g/g.go
View File

@@ -6,16 +6,12 @@ import (
var (
GlbClientCfg *ClientCfg
GlbServerCfg *ServerCfg
)
func init() {
GlbClientCfg = &ClientCfg{
ClientCommonConf: *config.GetDefaultClientConf(),
}
GlbServerCfg = &ServerCfg{
ServerCommonConf: *config.GetDefaultServerConf(),
}
}
type ClientCfg struct {
@@ -24,9 +20,3 @@ type ClientCfg struct {
CfgFile string
ServerUdpPort int // this is configured by login response from frps
}
type ServerCfg struct {
config.ServerCommonConf
CfgFile string
}