1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

docs(config/etcd): fix the missing step of Load (#2450)

Co-authored-by: Guoqiang Ding <guoqiang10@staff.sina.com.cn>
This commit is contained in:
Guoqiang Ding 2022-10-18 20:05:37 +08:00 committed by GitHub
parent d82d607c21
commit e3feea6eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,12 +30,16 @@ if err != nil {
c := config.New(config.WithSource(source))
defer c.Close()
// load sources before get
if err := c.Load(); err != nil {
log.Fatalln(err)
}
// acquire config value
foo, err := c.Value("/app-config").String()
if err != nil {
log.Println(err)
log.Fatalln(err)
}
println(foo)
log.Println(foo)
```