50 lines
1020 B
Go
50 lines
1020 B
Go
package server
|
|
|
|
import (
|
|
cs "git.loafle.net/commons/server-go"
|
|
oge "git.loafle.net/overflow/gateway/external"
|
|
ogrs "git.loafle.net/overflow/gateway_rest/server"
|
|
"git.loafle.net/overflow/member_gateway_rest/config"
|
|
)
|
|
|
|
type ServerHandler interface {
|
|
ogrs.ServerHandler
|
|
}
|
|
|
|
type ServerHandlers struct {
|
|
ogrs.ServerHandlers
|
|
|
|
Config *config.Config
|
|
}
|
|
|
|
func (sh *ServerHandlers) Init(serverCtx cs.ServerCtx) error {
|
|
if err := sh.ServerHandlers.Init(serverCtx); nil != err {
|
|
return err
|
|
}
|
|
oge.InitPackage(sh.Config.External)
|
|
|
|
return nil
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnStart(serverCtx cs.ServerCtx) error {
|
|
if err := sh.ServerHandlers.OnStart(serverCtx); nil != err {
|
|
return err
|
|
}
|
|
|
|
oge.StartPackage(sh.Config.External)
|
|
|
|
return nil
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnStop(serverCtx cs.ServerCtx) {
|
|
oge.StopPackage(sh.Config.External)
|
|
|
|
sh.ServerHandlers.OnStop(serverCtx)
|
|
}
|
|
|
|
func (sh *ServerHandlers) Destroy(serverCtx cs.ServerCtx) {
|
|
oge.DestroyPackage(sh.Config.External)
|
|
|
|
sh.ServerHandlers.Destroy(serverCtx)
|
|
}
|