Created
November 6, 2022 22:23
-
-
Save mainawycliffe/a46b7d6d55582ef30eca4e63f46bba33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// set out config format type - we will use json, but you can use yaml, toml, etc. | |
viper.SetConfigType("json") | |
// this function will read the config from firestore | |
go ReadFirestoreConfigs() | |
// delay to allow the config to be read | |
time.Sleep(1 * time.Second) | |
// this is your application running | |
fmt.Println("Starting to print config every 5 seconds") | |
for { | |
time.Sleep(time.Second * 5) // delay after each request | |
fmt.Println("latest", viper.AllSettings()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment