Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // C 全局配置(需要先执行MustLoad,否则拿不到配置) C = new(Config) )
Functions ¶
Types ¶
type CORS ¶
type CORS struct { Enable bool AllowOrigins []string AllowMethods []string AllowHeaders []string AllowCredentials bool MaxAge int }
CORS 跨域请求配置参数
type Config ¶
type Config struct { RunMode string `default:"release"` Swagger bool PrintConfig bool HTTP HTTP Casbin Casbin Logging Logging RateLimiter RateLimiter JWTAuth JWTAuth CORS CORS GZIP GZIP Redis Redis MySQL MySQL MySQL2 MySQL Postgres Postgres Sqlite3 Sqlite3 WWW WWW I18N I18N MiddleConfig MiddleConfig }
Config 配置参数
type HTTP ¶
type HTTP struct { Host string `default:"0.0.0.0"` Port int `default:"80"` CertFile string KeyFile string ShutdownTimeout int MaxContentLength int64 ContextPath string `default:"api"` Prefixes []string }
HTTP http配置参数
type JWTAuth ¶
type JWTAuth struct { Enable bool `default:"true"` SigningMethod string SigningKey string SigningSecret string Expired int Store string FilePath string RedisDB int RedisPrefix string LimitTime int64 `default:"0"` // 同时间内, 获取的访问令牌相同, 可以配置<=0, 不使用缓存 LimitExpired int `default:"7200"` // 访问令牌过期时间, 默认60分钟 LimitRefresh int `default:"86400"` // 刷新令牌过期时间, 默认24小时 AuthzServer string // 认证服务器, 子服务器需要认证权限时候调用 }
JWTAuth 用户认证
type Logging ¶
type Logging struct { Level string `default:"info"` Format string // json | text Output string OutputFile string EnableSyslogHook bool SyslogNetwork string `default:"udp"` SyslogAddr string SyslogTag string }
Logging 日志配置参数
type MySQL ¶
type MySQL struct { Host string Port int User string Password string DBName string Parameters string }
MySQL mysql配置参数
type Postgres ¶
type Postgres struct { Host string Port int User string Password string DBName string SSLMode string }
Postgres postgres配置参数
type RateLimiter ¶
RateLimiter 请求频率限制配置参数
Click to show internal directories.
Click to hide internal directories.