ServerConf
This commit is contained in:
parent
b41a60a932
commit
4b43bc3533
|
@ -3,7 +3,7 @@ package conf
|
|||
// AppConfig
|
||||
// 配置文件
|
||||
type AppConfig struct {
|
||||
// 服务器配置
|
||||
// 服务端配置
|
||||
Server *ServerConf `json:"server" yaml:"server"`
|
||||
// 网页配置
|
||||
Web *WebConf `json:"web" yaml:"web"`
|
||||
|
@ -17,8 +17,8 @@ type AppConfig struct {
|
|||
|
||||
// ServerConf 服务端配置
|
||||
type ServerConf struct {
|
||||
// 是否启用
|
||||
Enable bool `json:"enable" yaml:"enable"`
|
||||
// 是否启用WEB控制台支持
|
||||
Web bool `json:"enable" yaml:"enable"`
|
||||
// 监听地址
|
||||
Host string `json:"host" yaml:"host"`
|
||||
// 监听端口
|
||||
|
@ -29,12 +29,7 @@ type ServerConf struct {
|
|||
|
||||
// WebConf 网页服务配置
|
||||
type WebConf struct {
|
||||
// 是否启用
|
||||
Enable bool `json:"enable" yaml:"enable"`
|
||||
// 监听地址
|
||||
Host string `json:"host" yaml:"host"`
|
||||
// 监听端口
|
||||
Port int `json:"port" yaml:"port"`
|
||||
Info string `json:"info" yaml:"info"`
|
||||
}
|
||||
|
||||
// TaskConf 定时任务配置
|
||||
|
|
|
@ -14,15 +14,14 @@ func EditServer(host string, port int, key string) *AppConfig {
|
|||
return appConf
|
||||
}
|
||||
|
||||
func EditWeb(host string, port int) *AppConfig {
|
||||
appConf.Web.Host = host
|
||||
appConf.Web.Port = port
|
||||
func EditWeb(info string) *AppConfig {
|
||||
appConf.Web.Info = info
|
||||
WriteConfig()
|
||||
return appConf
|
||||
}
|
||||
|
||||
func ExecWeb(run bool) *AppConfig {
|
||||
appConf.Web.Enable = run
|
||||
appConf.Server.Web = run
|
||||
WriteConfig()
|
||||
return appConf
|
||||
}
|
||||
|
|
|
@ -56,15 +56,13 @@ func defaultAppConfig() *AppConfig {
|
|||
|
||||
return &AppConfig{
|
||||
Server: &ServerConf{
|
||||
Enable: false,
|
||||
Host: "0.0.0.0",
|
||||
Port: 36851,
|
||||
Key: serverKey,
|
||||
Web: false,
|
||||
Host: "0.0.0.0",
|
||||
Port: 36851,
|
||||
Key: serverKey,
|
||||
},
|
||||
Web: &WebConf{
|
||||
Enable: false,
|
||||
Host: "0.0.0.0",
|
||||
Port: 36852,
|
||||
Info: "网页管理端",
|
||||
},
|
||||
Task: &TaskConf{
|
||||
Delay: 0,
|
||||
|
|
Loading…
Reference in New Issue
Block a user