Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Ajax bool `toml:"only_ajax"` CORS *CORS `toml:"cors" validate:"required"` Header *Header `toml:"header" validate:"required"` JWT *JWT `toml:"jwt" validate:"required"` }
API is Rest API property
type BasicAuth ¶
type BasicAuth struct { User string `toml:"user" validate:"required"` Pass string `toml:"pass" validate:"required"` }
BasicAuth is Basic Auth property
type CORS ¶
type CORS struct { Enabled bool `toml:"enabled"` Origins []string `toml:"origins" validate:"required"` Headers []string `toml:"headers" validate:"required"` Methods []string `toml:"methods" validate:"required"` Credentials bool `toml:"credentials"` }
CORS is CORS property
type Develop ¶
type Develop struct { ProfileEnable bool `toml:"profile_enable"` RecoverEnable bool `toml:"recover_enable"` }
Develop is development use
type Docs ¶
type Docs struct {
Path string `toml:"path" validate:"required"`
}
Docs is document root path of go-gin-wrapper project
type Facebook ¶
type Facebook struct { Encrypted bool `toml:"encrypted"` ClientID string `toml:"client_id"` ClientSecret string `toml:"client_secret"` CallbackURL string `toml:"call_back_url"` }
Facebook is Facebook OAuth2 property
type Google ¶
type Google struct { Encrypted bool `toml:"encrypted"` ClientID string `toml:"client_id"` ClientSecret string `toml:"client_secret"` CallbackURL string `toml:"call_back_url"` }
Google is Google OAuth2 property
type Hash ¶
type Hash struct { Salt1 string `toml:"salt1" validate:"required"` Salt2 string `toml:"salt2" validate:"required"` }
Hash is hash salt
type Header ¶
type Header struct { Enabled bool `toml:"enabled"` Header string `toml:"header" validate:"required"` Key string `toml:"key" validate:"required"` }
Header is original http header property for authentication
type JWT ¶
type JWT struct { Mode jwts.JWTAlgo `toml:"mode" validate:"oneof=hmac rsa"` Audience string `toml:"audience" validate:"required"` Secret string `toml:"secret_code"` PrivateKey string `toml:"private_key"` PublicKey string `toml:"public_key"` }
JWT is JWT Auth property
type Logger ¶
type Logger struct { Service string `toml:"service" validate:"required"` Env string `toml:"env" validate:"oneof=dev prod custom"` Level string `toml:"level" validate:"required"` IsStackTrace bool `toml:"is_stacktrace"` }
Logger is zap logger property
type MySQL ¶
type MySQL struct { *MySQLContent Test *MySQLContent `toml:"test"` }
MySQL is MySQL Server property
type MySQLContent ¶
type MySQLContent struct { Encrypted bool `toml:"encrypted"` Host string `toml:"host"` Port uint16 `toml:"port"` DBName string `toml:"dbname"` User string `toml:"user"` Pass string `toml:"pass"` IsDebugLog bool `toml:"is_debug_log"` }
MySQLContent is MySQL Server property
type Proxy ¶
type Proxy struct { Mode types.ProxyMode `toml:"mode" validate:"oneof=no go-gin-proxy nginx"` Server *ProxyServer `toml:"server"` }
Proxy is reverse proxy server property
type ProxyServer ¶
type ProxyServer struct { Scheme string `toml:"scheme"` Host string `toml:"host"` Port int `toml:"port"` WebPort []int `toml:"web_port"` }
ProxyServer is reverse proxy server property
type Redis ¶
type Redis struct { Encrypted bool `toml:"encrypted"` Host string `toml:"host"` Port uint16 `toml:"port"` Pass string `toml:"pass"` IsSession bool `toml:"is_session"` IsHeroku bool `toml:"is_heroku"` }
Redis is Redis Server property
type Root ¶
type Root struct { Logger *Logger `toml:"logger" validate:"required"` Hash *Hash `toml:"hash" validate:"required"` Server *Server `toml:"server" validate:"required"` Proxy *Proxy `toml:"proxy" validate:"required"` API *API `toml:"api" validate:"required"` Auth *Auth `toml:"auth" validate:"required"` MySQL *MySQL `toml:"mysql" validate:"required"` Redis *Redis `toml:"redis" validate:"required"` Develop *Develop }
Root is config root
func GetConf ¶
GetConf returns *Root for unittest e.g. `conf, err = config.GetConf("settings.toml")`
func GetEnvConf ¶
GetEnvConf returns *Root from environment variable `$GO-GIN_CONF` for unittest
type Server ¶
type Server struct { IsRelease bool `toml:"is_release"` Scheme string `toml:"scheme" validate:"required"` Host string `toml:"host" validate:"required"` Port int `toml:"port" validate:"required"` Docs *Docs `toml:"docs" validate:"required"` Token *Token `toml:"token" validate:"required"` Session *Session `toml:"session" validate:"required"` BasicAuth *BasicAuth `toml:"basic_auth" validate:"required"` }
Server is web server property