Search⌘ K

Understanding Remote Configuration

Explore how to enable remote configuration in Go programs with Viper and Cobra. Understand the use of centralized key-value stores such as etcd, Consul, and Firestore for dynamic configuration updates without redeployment. Learn the setup and integration steps to manage configs remotely for distributed applications.

In the age of the cloud and distributed systems, applications often run in multiple instances or containers. Pushing a configuration change to all the instances simultaneously is often not trivial. With remote configuration, all the instances can read their configuration from a single source of truth.

Overview

Viper can work with multiple remote key-value stores as configuration sources. Remote configuration has the lowest priority, besides defaults. Configuration files, environment variables, and command-line arguments can all override it. Let’s discuss the key-value stores Viper supports as remote configuration sources.

Understanding remote key-value stores

Remote key-value stores can store and retrieve configuration data as key-value pairs. The data is stored in a central location and serves as a one-stop shop for the clients. This enables dynamic configuration because there is no need to re-deploy or even re-run the program with a new configuration file, ...