config

package
v0.0.0-...-cea81e8 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Configer            IConfiger
	FileConfigerFactory map[string]func(string,
		string,
		string,
		string,
		bool,
		interface{}) IConfiger = make(map[string]func(string, string, string, string, bool, interface{}) IConfiger)

	RemoteConfigerFactory map[string]func(string,
		string,
		string,
		string,
		bool,
		interface{}) IConfiger = make(map[string]func(string, string, string, string, bool, interface{}) IConfiger)
)

Functions

func ParseConfig

func ParseConfig(configPath string, rawVal interface{}, watchChange bool) error
  1. For static config file, the configPath will be <path>/<file>. i.e. ./conf/app.yaml
  2. For remote key/value store, the configPath will be <kvstoreType>#<kvstoreHost>#<kvstoreKey>#kvstoreType。 i.e. etcd|http://127.0.0.1:4001|/config/hugo.yaml|yaml. Currently, only etcd, consul, and Google filestore are supported

Types

type BaseConfiger

type BaseConfiger struct {
	WatchChange bool
	RawVal      interface{}
}

type FileConfiger

type FileConfiger struct {
	BaseConfiger
	ConfigFile string
	ConfigName string
	ConfigType string
	ConfigPath string
}

type IConfiger

type IConfiger interface {
	// contains filtered or unexported methods
}

func NewIniConfiger

func NewIniConfiger(configFile string,
	configName string,
	configType string,
	configPath string,
	watchChange bool,
	rawVal interface{}) IConfiger

func NewYamlConfiger

func NewYamlConfiger(configFile string,
	configName string,
	configType string,
	configPath string,
	watchChange bool,
	rawVal interface{}) IConfiger

type IniConfiger

type IniConfiger struct {
	FileConfiger
}

type RemoteConfiger

type RemoteConfiger struct {
	BaseConfiger
	RemoteProvider string
	RemoteHost     string
	ConfigKey      string
	ConfigType     string
}

type YamlConfiger

type YamlConfiger struct {
	FileConfiger
}

Jump to

Keyboard shortcuts

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