setting

package
v0.0.0-...-72f410e Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfPath = "/Users/hohice/MyWorkspace/go/src/github.com/hohice/gin-web/pkg/setting/testdata"
View Source
var DefaultWalmHome = filepath.Join(HomeDir(), ".ginS")
View Source
var SyncNotifyFuncs []SyncNotifyFunc

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

func Close

func Close()

func HomeDir

func HomeDir() string

HomeDir returns the home directory for the current user

func Init

func Init() error

Init sets values from the environment.

func ReadConfigPath

func ReadConfigPath(vp *viper.Viper) error

func RegNotifyChannel

func RegNotifyChannel(channel chan struct{})

func RegSyncNotify

func RegSyncNotify(snf SyncNotifyFunc)

func SyncNotify

func SyncNotify() error

Types

type Configs

type Configs struct {
	Service string `mapstructure:"service"`
	Home    string `mapstructure:"home"`
	Debug   bool   `mapstructure:"debug"`
	Log     struct {
		Logformat string `mapstructure:"logformat"`
		LogPath   string `mapstructure:"logpath"`
	} `mapstructure:"log"`

	Http struct {
		HTTPPort     int           `mapstructure:"port"`
		ReadTimeout  time.Duration `mapstructure:"read_timeout"`
		WriteTimeout time.Duration `mapstructure:"write_timeout"`
	} `mapstructure:"http"`

	Secret struct {
		Account   map[string]string `mapstructure:"account"`
		Tls       bool              `mapstructure:"tls"`
		TlsVerify bool              `mapstructure:"tls-verify"`
		TlsKey    string            `mapstructure:"tls-key"`
		TlsCert   string            `mapstructure:"tls-cert"`
		TlsCaCert string            `mapstructure:"tls-ca-cert"`
	} `mapstructure:"secret"`

	Database struct {
		Enable      bool   `mapstructure:"enable"`
		Dirver      string `mapstructure:"mysql"`
		Username    string `mapstructure:"root"`
		Password    string `mapstructure:"password"`
		Host        string `mapstructure:"host"`
		Dbname      string `mapstructure:"dbname"`
		MaxOpenConn int    `mapstructure:"max_open_conn"`
		MaxIdleConn int    `mapstructure:"max_idle_conn"`
		MaxLifeTime int    `mapstructure:"max_life_time"`
	} `mapstructure:"database"`

	Helm struct {
		TillerConnectionTimeout time.Duration `mapstructure:"tiller_time_out"`
		TillerHost              string        `mapstructure:"tillerHost"`
	} `mapstructure:"helm"`

	Repo struct {
		Name string `mapstructure:"name"`
		URL  string `mapstructure:"url"`
	} `mapstructure:"repo"`

	Kube struct {
		MasterHost string `mapstructure:"master_host"`
		Context    string `mapstructure:"config"`
		Config     string `mapstructure:"context"`
	} `mapstructure:"kube"`

	Trace struct {
		ZipkinUrl string `mapstructure:"zipkin_url"`
	} `mapstructure:"trace"`

	Auth struct {
		Enable      bool   `mapstructure:"enable"`
		JwtSecret   string `mapstructure:"jwtsecret"`
		TokenLookup string `mapstructure:"tokenlookup"`
		AuthScheme  string `mapstructure:"authscheme"`
	} `mapstructure:"auth"`

	Limit struct {
		AddrMap     map[string]string `mapstructure:"addr_map"`
		DefaultRate int               `mapstructure:"default_rate"`
	} `mapstructure:"limit"`

	Circuit map[string]struct {
		Timeout                int `mapstructure:"timeout"`
		MaxConcurrentRequests  int `mapstructure:"max_concurrent_requests"`
		RequestVolumeThreshold int `mapstructure:"request_volume_threshold"`
		SleepWindow            int `mapstructure:"sleep_window"`
		ErrorPercentThreshold  int `mapstructure:"error_percent_threshold"`
	} `mapstructure:"circuit"`

	Devops struct {
		Url                 string `mapstructure:"url"`
		DefaultTemplateFile string `mapstructure:"default_template_file"`
	} `mapstructure:"devops"`

	Store struct {
		Bases map[string]struct {
			Type      string `mapstructure:"type"`
			Enable    bool   `mapstructure:"enable"`
			BasePath  string `mapstructure:"base_path"`
			IndexPath string `mapstructure:"index_path"`
			ValuePath string `mapstructure:"value_path"`
		} `mapstructure:"bases"`
	} `mapstructure:"store"`
}
var Config Configs

type SyncNotifyFunc

type SyncNotifyFunc func() error

Jump to

Keyboard shortcuts

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