confer

package
v0.0.0-...-6b52b4a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAppGet

func ConfigAppGet(key string) interface{}

func ConfigAppGetInt

func ConfigAppGetInt(key string, defaultConfig int) int

func ConfigAppGetString

func ConfigAppGetString(key string, defaultConfig string) string

func ConfigCodeGetMessage

func ConfigCodeGetMessage(code int) string

func ConfigCodeInit

func ConfigCodeInit()

func ConfigEnvGet

func ConfigEnvGet() string

func ConfigEnvIsBeta

func ConfigEnvIsBeta() bool

func ConfigEnvIsDev

func ConfigEnvIsDev() bool

func Init

func Init(configURL string) (err error)

Types

type APM

type APM struct {
	Addr  string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Http  bool   `mapstructure:"http" json:"http" yaml:"http"`
	Mysql bool   `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
	Redis bool   `mapstructure:"redis" json:"redis" yaml:"redis"`
}

type App

type App map[string]interface{}

type Code

type Code map[string]interface{}

type ConfigCodeList

type ConfigCodeList struct {
	Codes map[string]string
}

type DBBase

type DBBase struct {
	Host     string `mapstructure:"host" json:"host" yaml:"host"`
	Port     int    `mapstructure:"port" json:"port" yaml:"port"`
	User     string `mapstructure:"user" json:"user" yaml:"user"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DBName   string `json:"-"`
	Prefix   string `json:"-"`
}

type DBPool

type DBPool struct {
	PoolMinCap      int   `mapstructure:"pool-min-cap" json:"poolMinCap" yaml:"pool-min-cap"`
	PoolExCap       int   `mapstructure:"pool-ex-cap" json:"poolExCap" yaml:"pool-ex-cap"`
	PoolMaxCap      int   `mapstructure:"pool-max-cap" json:"pool-max-cap" yaml:"pool-max-cap"`
	PoolIdleTimeout int   `mapstructure:"pool-idle-timeout" json:"poolIdleTimeout" yaml:"pool-idle-timeout"`
	PoolWaitCount   int64 `mapstructure:"pool-wait-count" json:"poolWaitCount" yaml:"pool-wait-count"`
	PoolWaitTimeout int   `mapstructure:"pool-wai-timeout" json:"poolWaitTimeout" yaml:"pool-wai-timeout"`
}

type Log

type Log struct {
	Enabled bool         `mapstructure:"enabled" json:"enabled" yaml:"enabled"`
	OutPut  string       `mapstructure:"out-put" json:"outPut" yaml:"out-put"`
	Debug   bool         `mapstructure:"debug" json:"debug" yaml:"debug"`
	Key     string       `mapstructure:"key" json:"key" yaml:"key"`
	Level   logrus.Level `mapstructure:"level" json:"level" yaml:"level"`
	Redis   struct {
		Host string
		Port int
	}
	App struct {
		AppName    string `mapstructure:"app-name" json:"appName" yaml:"app-name"`
		AppID      string `mapstructure:"app-id" json:"appID" yaml:"app-id"`
		AppVersion string `mapstructure:"app-version" json:"appVersion" yaml:"app-version"`
		AppKey     string `mapstructure:"app-key" json:"appKey" yaml:"app-key"`
		Channel    string `mapstructure:"channel" json:"channel" yaml:"channel"`
		SubOrgKey  string `mapstructure:"sub-org-key" json:"subOrgKey" yaml:"sub-org-key"`
		Language   string `mapstructure:"language" json:"language" yaml:"language"`
	} `mapstructure:"app" json:"app" yaml:"app"`
}

type Mysql

type Mysql struct {
	Enabled bool     `mapstructure:"enabled" json:"enabled" yaml:"enabled"`
	DBName  string   `mapstructure:"dbname" json:"dbName" yaml:"dbname"`
	Prefix  string   `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Pool    DBPool   `mapstructure:"pool" json:"pool" yaml:"pool"`
	Write   DBBase   `mapstructure:"write" json:"write" yaml:"write"`
	Reads   []DBBase `mapstructure:"reads" json:"reads" yaml:"reads"`
}

type Redis

type Redis struct {
	Enabled bool   `mapstructure:"enabled" json:"enabled" yaml:"enabled"`
	Address string `mapstructure:"address" json:"address" yaml:"address"`
	Prefix  string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
}

type Server

type Server struct {
	App   App   `mapstructure:"app" json:"app" yaml:"app"`
	Code  Code  `mapstructure:"code" json:"code" yaml:"code"`
	Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
	Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
	Log   Log   `mapstructure:"log" json:"log" yaml:"log"`
	sync.RWMutex
}

func GlobalConfig

func GlobalConfig() *Server

Jump to

Keyboard shortcuts

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