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