# README
Package springcloud
- Implements general
config.KVStore
interface. Will load config from remote spring config-server or local file. - Setup for remote spring config
- Set environment
SPRING_CLOUD_CONFIG_URL
with remote config host:port - Set environment
SPRING_CLOUD_CONFIG_PATHS
with spring config paths, comma separate. E.g./myapp/dev,/myapp/local
- Set environment
- Setup for local file spring config
- Set environment
SPRING_CLOUD_CONFIG_URL
withfile://<local_machine_path>
. E.g.file://var/local/myapp.yml
SPRING_CLOUD_CONFIG_PATHS
env-var will be ignored
- Set environment
- To configure autorefresh, set
springcloud-config.refresh-interval
(duration) in your config. E.g.springcloud-config.refresh-interval: 10s
Secret values
- Use format
{cipher}<encryptedvalues>
to use encrypted values. E.g.{cipher}jalsdkjflasd43709uahlALJLdgajsdl
. To create encrypted string value, use<spring_remote_host>/encrypt
endpoint. - GCP SecretManager, use
{sm}<your_sm_key>
to use value from GCP secret manager. E.g.{sm}mysecret_database_password
will load value from GCP secret manager for keysecret_database_password
. Probably need to setupGOOGLE_APPLICATION_CREDENTIALS
environment variable too.
References
# Functions
NewRemoteConfig create *RemoteConfig with given existing *http.Client.
# Variables
ErrConfigNotFound returned when profiles doesn't exists in remote config.
ErrStatusCode returned when call to springcloud remote config returns HTTP other than 2xx.
# Structs
RemoteConfig wraps thread-safe *viper.Viper key-values from springcloud remote-config.