viper

package
v1.1.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLoad

func DefaultLoad(viper_ *viper.Viper, v proto.Message, cfgFile string, envPrefix string, protos ...proto.Message) error

DefaultLoad load config from file and protos into v, and save to a using file load sequence: protos..., file, env, replace if member has been set that is, later cfg appeared, higher priority cfg has

func DefaultPersisConfigPath added in v1.0.176

func DefaultPersisConfigPath(v *viper.Viper) string

DefaultPersisConfigPath returns the given file name to persist as YAML

func LoadGlobalConfig

func LoadGlobalConfig(v proto.Message, cfgFile string, envPrefix string, protos ...proto.Message) error

LoadGlobalConfig load config from the global Viper instance.

func MergeAll

func MergeAll(v *viper.Viper, cfgFile string, envPrefix string, protos ...proto.Message) error

MergeAll merge sequence: protos..., file, env, replace if member has been set

func MergeConfigFromENV

func MergeConfigFromENV(v *viper.Viper, envPrefix string)

MergeConfigFromENV read from env

func MergeConfigFromFile

func MergeConfigFromFile(v *viper.Viper, cfgFile string) error

MergeConfigFromFile read from file

func MergeConfigFromProtoMessages

func MergeConfigFromProtoMessages(v *viper.Viper, configType string, protos ...proto.Message) error

MergeConfigFromProtoMessages read from protobuf merge protos into viper one by one, replace if member has been set that is, later proto appeared, higher priority proto has

func PersistConfig

func PersistConfig(v *viper.Viper) error

PersistConfig writes config using into .use.<name>.yaml

func PersistConfigTo added in v1.0.176

func PersistConfigTo(v *viper.Viper, filename string) error

PersistConfigTo writes the completed component config into the given file name as YAML

func PersistGlobalConfig

func PersistGlobalConfig() error

func UnmarshalProtoMessageByJsonpb

func UnmarshalProtoMessageByJsonpb(viper_ *viper.Viper, v proto.Message, opts ...viper.DecoderConfigOption) error

UnmarshalProtoMessageByJsonpb returns the latest config viper proto

func UnmarshalProtoMessageByJsonpbHookFunc

func UnmarshalProtoMessageByJsonpbHookFunc(def proto.Message) mapstructure.DecodeHookFunc

UnmarshalProtoMessageByJsonpbHookFunc returns a DecodeHookFunc that converts root struct to config.ViperProto. Trick of protobuf, which generates json tag only

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL