/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
example/config/apollo/boot/boot.go
27 строк
578 B
John Guo
add `gcfg.Adapter` implements using apollo service (#2165)
30 сен 2022, 13:19
Не верифицирован
30 сен 2022, 13:19
127e8af
Код
Авторство
О чём код?
package boot import ( "github.com/gogf/gf/contrib/config/apollo/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" ) func init() { var ( ctx = gctx.GetInitCtx() appId = "SampleApp" cluster = "default" ip = "http://localhost:8080" ) // Create apollo Client that implements gcfg.Adapter. adapter, err := apollo.New(ctx, apollo.Config{ AppID: appId, IP: ip, Cluster: cluster, }) if err != nil { g.Log().Fatalf(ctx, `%+v`, err) } // Change the adapter of default configuration instance. g.Cfg().SetAdapter(adapter) }