/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
example/config/polaris/boot/boot.go
32 строки
726 B
houseme
feat: create polaris config (#2170)
09 окт 2022, 14:20
Не верифицирован
09 окт 2022, 14:20
6cb9102
Код
Авторство
О чём код?
package boot import ( "github.com/gogf/gf/contrib/config/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" ) func init() { var ( ctx = gctx.GetInitCtx() namespace = "default" fileGroup = "goframe" fileName = "config.yaml" path = "testdata/polaris.yaml" logDir = "/tmp/polaris/log" ) // Create polaris Client that implements gcfg.Adapter. adapter, err := polaris.New(ctx, polaris.Config{ Namespace: namespace, FileGroup: fileGroup, FileName: fileName, Path: path, LogDir: logDir, Watch: true, }) if err != nil { g.Log().Fatalf(ctx, `%+v`, err) } // Change the adapter of default configuration instance. g.Cfg().SetAdapter(adapter) }