From 1b743869b2a4ef7c6c19607253b8db54123babe2 Mon Sep 17 00:00:00 2001 From: YoyoFx Date: Thu, 29 Apr 2021 22:09:10 +0800 Subject: [PATCH] Update README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e0d03e2..1ab3ded 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,24 @@ Golang configuration,use to Viper reading from remote Nacos config systems. Viper remote for Naocs. ```go - runtime_viper := viper.New() +runtime_viper := viper.New() - remote.SetOptions(&remote.Option{ - Url: "localhost", - Port: 80, - NamespaceId: "public", - GroupName: "DEFAULT_GROUP", - Config: remote.Config{ DataId: "config_dev" }, - Auth: nil, - }) +remote.SetOptions(&remote.Option{ + Url: "localhost", + Port: 80, + NamespaceId: "public", + GroupName: "DEFAULT_GROUP", + Config: remote.Config{ DataId: "config_dev" }, + Auth: nil, +}) - err := remote_viper.AddRemoteProvider("nacos", "localhost", "") - remote_viper.SetConfigType("yaml") +err := remote_viper.AddRemoteProvider("nacos", "localhost", "") +remote_viper.SetConfigType("yaml") - _ = remote_viper.ReadRemoteConfig() //sync get remote configs to remote_viper instance memory . for example , remote_viper.GetString(key) - _ = remote_viper.WatchRemoteConfigOnChannel() //async watch , auto refresh configs. +_ = remote_viper.ReadRemoteConfig() //sync get remote configs to remote_viper instance memory . for example , remote_viper.GetString(key) +_ = remote_viper.WatchRemoteConfigOnChannel() //async watch , auto refresh configs. - appName := remote_viper.GetString("key") +appName := remote_viper.GetString("key") // sync get config by key - fmt.Println(appName) +fmt.Println(appName) ```