Skip to content

Instantly share code, notes, and snippets.

@mainawycliffe
Created November 6, 2022 22:23
Show Gist options
  • Save mainawycliffe/a46b7d6d55582ef30eca4e63f46bba33 to your computer and use it in GitHub Desktop.
Save mainawycliffe/a46b7d6d55582ef30eca4e63f46bba33 to your computer and use it in GitHub Desktop.
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