optimize service create if needed by config.yaml feature declare

pull/196/head
Michael Li 2 years ago
parent bd5351206d
commit bab9fd46f2
No known key found for this signature in database

@ -1,4 +1,5 @@
App: # APP基础设置项
RunMode: debug
AttachmentIncomeRate: 0.8
MaxCommentCount: 10
DefaultContextTimeout: 60
@ -12,6 +13,36 @@ Server: # 服务设置
WriteTimeout: 60
Features:
Default: []
WebServer: # Web服务
HttpIp: 0.0.0.0
HttpPort: 8010
ReadTimeout: 60
WriteTimeout: 60
AdminServer: # Admin后台运维服务
HttpIp: 0.0.0.0
HttpPort: 8014
ReadTimeout: 60
WriteTimeout: 60
SpaceXServer: # SpaceX服务
HttpIp: 0.0.0.0
HttpPort: 8012
ReadTimeout: 60
WriteTimeout: 60
BotServer: # Bot服务
HttpIp: 0.0.0.0
HttpPort: 8016
ReadTimeout: 60
WriteTimeout: 60
LocalossServer: # Localoss服务
HttpIp: 0.0.0.0
HttpPort: 8018
ReadTimeout: 60
WriteTimeout: 60
DocsServer: # 开发文档服务
HttpIp: 0.0.0.0
HttpPort: 8011
ReadTimeout: 60
WriteTimeout: 60
SmsJuhe:
Gateway: https://v.juhe.cn/sms/send
Key:

@ -58,14 +58,15 @@ func MaxSidSize(ss []Service) int {
}
func newService() (ss []Service) {
ss = append(ss, newWebService())
// add oldWebService if not depredcated OldWebService
cfg.Not("Deprecated:OldWeb", func() {
ss = append(ss, newOldWebService())
})
// add all service if declared in features on config.yaml
cfg.In(cfg.Actions{
"Web": func() {
ss = append(ss, newWebService())
},
"Admin": func() {
ss = append(ss, newAdminService())
},
@ -75,10 +76,9 @@ func newService() (ss []Service) {
"Bot": func() {
ss = append(ss, newBotService())
},
"LocalOSS": func() {
"NativeOBS": func() {
ss = append(ss, newLocalossService())
},
})
return
}

Loading…
Cancel
Save