Documentation
¶
Index ¶
- Constants
- func IsReady() bool
- type ConfigError
- type ConfigStruct
- type CorsConfig
- type CorsOrigin
- type FileConfig
- type FileLocationConfig
- type FrontConfig
- type GlobalConfig
- type HttpConfig
- type JwtConfig
- type LoggerLevel
- type MySQLConfig
- type ParserError
- type PasswordConfig
- type ProxyConfig
- type YamlConfig
Constants ¶
View Source
const AllowAllOrigin = "*"
View Source
const CorsDefaultMaxAgeSec = CorsMaxAgeSec
View Source
const CorsMaxAgeSec = 86400
View Source
const DefaultFileMapSize = 10
View Source
const DefaultOriginListSize = 10
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigError ¶
type ConfigError interface { error Msg() string Error() string Warning() string IsError() bool IsWarning() bool }
func InitConfig ¶
func InitConfig() ConfigError
func NewConfigError ¶
func NewConfigError(msg string) ConfigError
func NewConfigWarning ¶
func NewConfigWarning(msg string) ConfigError
type ConfigStruct ¶
type ConfigStruct struct { Yaml YamlConfig File FileLocationConfig CoreOrigin CorsOrigin // contains filtered or unexported fields }
func Config ¶
func Config() *ConfigStruct
func (*ConfigStruct) GetSignalChan ¶
func (c *ConfigStruct) GetSignalChan() chan os.Signal
type CorsConfig ¶
type CorsConfig struct { AllowCors utils.StringBool `json:"allowcors"` AllowOrigin []string `json:"alloworigin"` AllowOriginReg []string `json:"alloworiginres"` MaxAgeSec int `json:"maxagesec"` }
func (*CorsConfig) Disable ¶
func (c *CorsConfig) Disable() bool
func (*CorsConfig) Enable ¶
func (c *CorsConfig) Enable() bool
type CorsOrigin ¶
func (*CorsOrigin) ApplyReg ¶
func (c *CorsOrigin) ApplyReg(origin string) error
func (*CorsOrigin) InOriginList ¶
func (c *CorsOrigin) InOriginList(origin string) bool
func (*CorsOrigin) SetString ¶
func (c *CorsOrigin) SetString(origins []string) error
type FileConfig ¶
type FileConfig struct {
LocalPath string `yaml:"localpath"`
}
type FileLocationConfig ¶
type FrontConfig ¶
type GlobalConfig ¶
type GlobalConfig struct { Mode string `json:"mode"` LogLevel string `json:"loglevel"` LogTag utils.StringBool `json:"logtag"` }
func (*GlobalConfig) GetGinMode ¶
func (g *GlobalConfig) GetGinMode() string
func (*GlobalConfig) IsDebug ¶
func (g *GlobalConfig) IsDebug() bool
func (*GlobalConfig) IsRelease ¶
func (g *GlobalConfig) IsRelease() bool
func (*GlobalConfig) IsTest ¶
func (g *GlobalConfig) IsTest() bool
type HttpConfig ¶
type HttpConfig struct { Address string `yaml:"address"` DebugMsg utils.StringBool `yaml:"debugmsg"` BasePath string `yaml:"basepath"` ApiPath string `yaml:"apipath"` PingPath string `yaml:"pingpath"` ResourcePath string `yaml:"resourcepath"` EnableTestAPI string `yaml:"enabletestapi"` Proxy ProxyConfig `yaml:"proxy"` StopSecret string `yaml:"stopsecret"` StopWaitSecond int `yaml:"stopwaitsecond"` Cors CorsConfig `yaml:"cors"` }
func (*HttpConfig) CheckStopSecret ¶
func (h *HttpConfig) CheckStopSecret(secret string) bool
type LoggerLevel ¶
type LoggerLevel string
type MySQLConfig ¶
type MySQLConfig struct { UserName string `yaml:"username"` Password string `yaml:"password"` Address string `yaml:"address"` Port int64 `yaml:"port"` DBName string `yaml:"dbname"` ActiveShutdown utils.StringBool `yaml:"activeshutdown"` FakeData utils.StringBool `yaml:"fakedata"` }
type ParserError ¶
func NewParserError ¶
func NewParserError(data interface{}, msg ...string) ParserError
func WarpParserError ¶
func WarpParserError(err error) ParserError
type PasswordConfig ¶
type ProxyConfig ¶
type ProxyConfig struct { Proxy utils.StringBool `json:"proxy"` TrustedIPs []string `json:"trustedips"` }
func (*ProxyConfig) Enable ¶
func (p *ProxyConfig) Enable() bool
type YamlConfig ¶
type YamlConfig struct { GlobalConfig `yaml:",inline"` Mysql MySQLConfig `yaml:"mysql"` File FileConfig `yaml:"file"` Http HttpConfig `yaml:"http"` Front FrontConfig `yaml:"front"` Jwt JwtConfig `yaml:"jwt"` Password PasswordConfig `yaml:"password"` }
Click to show internal directories.
Click to hide internal directories.