refactor all service dependency injection
This commit is contained in:
@@ -8,10 +8,17 @@ import (
|
||||
|
||||
type Config = config.SrvConfig
|
||||
|
||||
func Expose(engine *gin.Engine, cfg *Config) error {
|
||||
if cfg != nil {
|
||||
config.Spec = *cfg
|
||||
type ExposeOptions struct {
|
||||
Dependencies
|
||||
Engine *gin.Engine
|
||||
Config *Config
|
||||
}
|
||||
|
||||
func Expose(options ExposeOptions) error {
|
||||
applyDependencies(options.Dependencies)
|
||||
if options.Config != nil {
|
||||
config.Spec = *options.Config
|
||||
}
|
||||
routers.Register("mgt", engine)
|
||||
routers.Register("mgt", options.Engine)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user