diff --git a/app/mix/cmd_offline/main.go b/app/mix/cmd_offline/main.go index a66d5056..09e5cac4 100644 --- a/app/mix/cmd_offline/main.go +++ b/app/mix/cmd_offline/main.go @@ -57,7 +57,7 @@ func main() { } // 初始化日志 - logger.InitLogger(cfg.OfflineServer.Log) + logger.InitLogger(*cfg.OfflineServer.Log) // 初始化短信服务 err = sms.Init(cfg.Dysmsapi) diff --git a/app/mix/conf/cfg.go b/app/mix/conf/cfg.go index 9c788fac..9f574a4b 100644 --- a/app/mix/conf/cfg.go +++ b/app/mix/conf/cfg.go @@ -23,5 +23,5 @@ type ConfigSt struct { VideoModeration *configcenter.VideoModerationConfig `json:"video_moderation" yaml:"video_moderation"` // 视频审核 ElasticSearch *configcenter.ElasticSearchConfig `json:"elastic_search" yaml:"elastic_search"` // es SD *configcenter.ConsulServiceDiscovery `json:"sd" yaml:"sd"` - OfflineServer *configcenter.DefaultConfig `json:"offline_server" yaml:"offline_server"` + OfflineServer *configcenter.OfflineServerConfig `json:"offline_server" yaml:"offline_server"` // 离线任务 } diff --git a/library/configcenter/configcenter.go b/library/configcenter/configcenter.go index cac3340d..064dc5c5 100644 --- a/library/configcenter/configcenter.go +++ b/library/configcenter/configcenter.go @@ -179,6 +179,12 @@ type ConsulServiceDiscovery struct { ServiceName string `json:"service_name" yaml:"service_name"` } +// 离线机器配置 +type OfflineServerConfig struct { + Log *LoggerConfig `json:"log" yaml:"log"` // 日志配置 + App *AppConfig `json:"app" yaml:"app"` // 服务配置 +} + func LoadConfig(configFilePath string, cfg interface{}) error { cfgStr, err := ioutil.ReadFile(configFilePath) if err != nil { diff --git a/library/httpserver/httpserver.go b/library/httpserver/httpserver.go index 5c6b79bd..da31119b 100644 --- a/library/httpserver/httpserver.go +++ b/library/httpserver/httpserver.go @@ -101,7 +101,7 @@ func setServerStatusFD(status string) { logger.Info("SetServerStatusFD success: %v", status) } -func StartOfflineHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig) { +func StartOfflineHttpServer(srv *http.Server, cfg *configcenter.OfflineServerConfig) { go func() { if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { logger.Fatal("listen: %v", err)