diff --git a/cmd/api/server.go b/cmd/api/server.go index 693858e1..635ee94f 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -58,8 +58,7 @@ func setup() { // 注入配置扩展项 config.ExtendConfig = &ext.ExtConfig //1. 读取配置 - config.Setup(file.NewSource, file.WithPath(configYml)) - go config.Watch() + config.Setup(file.NewSource(file.WithPath(configYml))) //2. 设置日志 sdk.Runtime.SetLogger( logger.SetupLogger( @@ -70,8 +69,6 @@ func setup() { //3. 初始化数据库链接 database.Setup() - //list := sdk.Runtime.GetDb() - //list["*"] //4. 设置缓存 cacheAdapter, err := config.CacheConfig.Setup() if err != nil { @@ -113,8 +110,6 @@ func setup() { } func run() error { - defer config.Stop() - if config.ApplicationConfig.Mode == pkg.ModeProd.String() { gin.SetMode(gin.ReleaseMode) } diff --git a/cmd/config/server.go b/cmd/config/server.go index 388b4ed7..52ce85be 100644 --- a/cmd/config/server.go +++ b/cmd/config/server.go @@ -27,7 +27,7 @@ func init() { } func run() { - config.Setup(file.NewSource, file.WithPath(configYml)) + config.Setup(file.NewSource(file.WithPath(configYml))) application, errs := json.MarshalIndent(config.ApplicationConfig, "", " ") //转换成JSON返回的是byte[] if errs != nil { diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index f9ba1274..bc252d19 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -49,7 +49,7 @@ func run() { if !generate { fmt.Println(`start init`) //1. 读取配置 - config.Setup(file.NewSource, file.WithPath(configYml)) + config.Setup(file.NewSource(file.WithPath(configYml))) //2. 设置日志 sdk.Runtime.SetLogger( logger.SetupLogger( diff --git a/go.mod b/go.mod index fa807a37..1b4b01e3 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/bytedance/go-tagexpr/v2 v2.7.10 github.com/casbin/casbin/v2 v2.25.1 github.com/gin-gonic/gin v1.7.1 - github.com/go-admin-team/go-admin-core v1.3.5-rc.3.0.20210609055649-3acdd6f47eab - github.com/go-admin-team/go-admin-core/sdk v1.3.0-rc.3.0.20210609055649-3acdd6f47eab + github.com/go-admin-team/go-admin-core v1.3.5-rc.3.0.20210609062350-5aeb6bd49b09 + github.com/go-admin-team/go-admin-core/sdk v1.3.0-rc.3.0.20210609082125-a317acc34456 github.com/google/uuid v1.2.0 github.com/mssola/user_agent v0.5.2 github.com/opentracing/opentracing-go v1.1.0