Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func Int(v int) *int
- func Int64(v int64) *int64
- func LoadDefault(propNames []string) (map[string]interface{}, error)
- func LoadDefaultDynamic(ctx context.Context, propNames []string, ...) (map[string]interface{}, error)
- func LoadDefaultDynamicWithEnv(env SpringEnv, ctx context.Context, propNames []string, ...) (map[string]interface{}, error)
- func LoadDefaultWithEnv(env SpringEnv, propNames []string) (map[string]interface{}, error)
- func LoadProperties(propNames []string, configDir string, envKeyPairs []string) (map[string]interface{}, error)
- func String(v string) *string
- type SpringEnv
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
func Int64 ¶
Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.
func LoadDefault ¶
LoadDefault will use the following defaults:
Check for the following config locations:
- /opt/spinnaker/config
- /home/spinnaker/config
- /root/config
- HOME_DIR/.spinnaker
Profiles:
- armory
- local
Env:
Pulls os.Environ()
Specify propNames in the same way as LoadProperties().
func LoadDefaultDynamic ¶
func LoadDefaultDynamic(ctx context.Context, propNames []string, updateFn func(map[string]interface{}, error)) (map[string]interface{}, error)
Similar to LoadDefault but provides a callback function that will be invoked when a configuration change is detected. Parsing errors are also provided to the callback, so check for these as well. This works by keeping track of files parsed during the initial parsing, it means that files will only be tracked if they contain something. e.g. you cannot dynamically add a profile. Environment variables are frozen on the initial run. This is by design
func LoadDefaultDynamicWithEnv ¶ added in v0.0.3
func LoadDefaultWithEnv ¶ added in v0.0.3
func LoadProperties ¶
func LoadProperties(propNames []string, configDir string, envKeyPairs []string) (map[string]interface{}, error)
LoadProperties tries to do what spring properties manages by loading files using the right precedence and returning a merged map that contains all the keys and their values have been substituted for the correct value
Usage:
If you want to load the following files: - spinnaker.yml/yaml - spinnaker-local.yml/yaml - gate-local.yml/yaml - gate-armory.yml/yaml
Then For propNames you would give:
["spinnaker", "gate"]
and you'll need to make sure your envKeyPairs has the following key pair as one of it's variables
SPRING_PROFILES_ACTIVE="armory,local"