Skip to content
geelevelgeelevel

Configuration File ​

JWT ​

yaml ​

yaml
# jwt configuration
jwt:
  signing-key: 'qmPlus'
  expires-time: 7d
  buffer-time: 1d

struct ​

go
type JWT struct {
	SigningKey  string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"`    // jwt signature
	ExpiresTime string `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // expiration time
	BufferTime  string `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"`    // buffer time
	Issuer      string `mapstructure:"issuer" json:"issuer" yaml:"issuer"`                   // issuer
}

description ​

Configuration NameTypeDescription
signing-keystringjwt signature
expires-timeint64expiration time
buffer-timeint64buffer time (requests within this time before expiration will refresh jwt renewal)
issuerstringjwt issuer

Zap ​

yaml ​

yaml
# zap logger configuration
zap:
  level: 'info'
  format: 'console'
  prefix: '[GIN-VUE-ADMIN]'
  director: 'log'
  show-line: true
  encode-level: 'LowercaseColorLevelEncoder'
  stacktrace-key: 'stacktrace'
  log-in-console: true
  retention-day: 7

struct ​

go
type Zap struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"`                            // Level
	Prefix        string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`                         // Log prefix
	Format        string `mapstructure:"format" json:"format" yaml:"format"`                         // Output
	Director      string `mapstructure:"director" json:"director"  yaml:"director"`                  // Log folder
	EncodeLevel   string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"`       // Encode level
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // Stack name
	ShowLine      bool   `mapstructure:"show-line" json:"show-line" yaml:"show-line"`                // Show line
	LogInConsole  bool   `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // Output to console
	RetentionDay  int    `mapstructure:"retention-day" json:"retention-day" yaml:"retention-day"`    // Log retention days
}

description ​

Configuration NameTypeDescription
levelstringDetailed description of level modes, see zap official documentation
info: info mode, no error stack information, only output information
debug: debug mode, detailed error stack information
warn: warn mode
error: error mode, detailed error stack information
dpanic: dpanic mode
panic: panic mode
fatal: fatal mode
formatstringconsole: console format output logs json: json format output logs
prefixstringLog prefix
directorstringLog folder, modify as needed, no need to manually create
show_lineboolShow line numbers, default true, not recommended to modify
encode_levelstringLowercaseLevelEncoder: lowercase
LowercaseColorLevelEncoder: lowercase with color
CapitalLevelEncoder: uppercase
CapitalColorLevelEncoder: uppercase with color
stacktrace_keystringStack name, the json key when outputting logs in json format
log_in_consoleboolWhether to output to console, default true
retention_dayintLog retention days
  • Development Environment || Debug Environment Configuration Recommendations
    • level:debug
    • format:console
    • encode-level:LowercaseColorLevelEncoder or encode-leve:CapitalColorLevelEncoder
  • Production Environment Configuration Recommendations
    • level:error
    • format:json
    • encode-level: LowercaseLevelEncoder or encode-level:CapitalLevelEncoder
    • log-in-console: false
  • These are just recommendations, adjust according to your needs, provided for reference only

Redis ​

yaml ​

yaml
# redis configuration
redis:
  name: ''
  addr: '127.0.0.1:6379'
  password: ''
  db: 0
  use-cluster: false
  cluster-addrs: []

struct ​

go
type Redis struct {
	Name         string   `mapstructure:"name" json:"name" yaml:"name"`                         // Represents the name of the current instance
	Addr         string   `mapstructure:"addr" json:"addr" yaml:"addr"`                         // Server address:port
	Password     string   `mapstructure:"password" json:"password" yaml:"password"`             // Password
	DB           int      `mapstructure:"db" json:"db" yaml:"db"`                               // Which database in single instance mode redis
	UseCluster   bool     `mapstructure:"useCluster" json:"useCluster" yaml:"useCluster"`       // Whether to use cluster mode
	ClusterAddrs []string `mapstructure:"clusterAddrs" json:"clusterAddrs" yaml:"clusterAddrs"` // Node address list in cluster mode
}

description ​

Configuration NameTypeDescription
namestringRepresents the name of the current instance
addrstringRedis connection address and port
passwordstringPassword
dbintWhich database in redis
use-clusterboolWhether to use cluster mode
cluster-addrs[]stringNode address list in cluster mode

Email ​

yaml ​

yaml
# email configuration
email:
  to: 'xxx@qq.com'
  port: 465
  from: 'xxx@163.com'
  host: 'smtp.163.com'
  is-ssl: true
  secret: 'xxx'
  nickname: 'test'
  is-loginauth: false

struct ​

go
type Email struct {
	To          string `mapstructure:"to" json:"to" yaml:"to"`                               // Recipients: multiple separated by English commas, e.g.: a@qq.com b@qq.com, in formal development please use this item as a parameter
	From        string `mapstructure:"from" json:"from" yaml:"from"`                         // Sender: your own email address for sending emails
	Host        string `mapstructure:"host" json:"host" yaml:"host"`                         // Server address, e.g. smtp.qq.com, please check the SMTP protocol from QQ or the email you want to send from
	Secret      string `mapstructure:"secret" json:"secret" yaml:"secret"`                   // Secret key for login, preferably not using email password, apply for a login secret key from email SMTP
	Nickname    string `mapstructure:"nickname" json:"nickname" yaml:"nickname"`             // Nickname: sender nickname, usually your own email
	Port        int    `mapstructure:"port" json:"port" yaml:"port"`                         // Port: please check the SMTP protocol from QQ or the email you want to send from, mostly 465
	IsSSL       bool   `mapstructure:"is-ssl" json:"is-ssl" yaml:"is-ssl"`                   // Whether SSL: whether to enable SSL
	IsLoginAuth bool   `mapstructure:"is-loginauth" json:"is-loginauth" yaml:"is-loginauth"` // Whether LoginAuth: whether to use LoginAuth authentication method (suitable for IBM, Microsoft email servers, etc.)
}

description ​

Configuration NameTypeDescription
tostringEmail recipients, can be multiple,
separated by English commas (,), preferably no spaces, if it's one email please don't add English comma (,) at the end
fromstringSender email address
hoststringMain server address of the email
secretstringSecret key for login, preferably not using email password
nicknamestringSender nickname
portintEmail service port
is-sslboolWhether to use SSL
is-loginauthboolWhether to use LoginAuth authentication method (suitable for IBM, Microsoft email servers, etc.)

Casbin ​

yaml ​

yaml
# casbin configuration
casbin:
  model-path: './resource/rbac_model.conf'

struct ​

go
type Casbin struct {
	ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
}

description ​

Configuration NameTypeDescriptionRecommended to Modify
model-pathstringRelative path to store casbin model
Default value is ./resource/rbac_model.conf
Not recommended

System ​

yaml ​

yaml
# system configuration
system:
  env: 'public'
  db-type: 'mysql'
  oss-type: 'local'
  router-prefix: ''
  addr: 8888
  iplimit-count: 15000
  iplimit-time: 3600
  use-multipoint: false
  use-redis: false
  use-mongo: false
  use-strict-auth: false

struct ​

go
type System struct {
	Env           string `mapstructure:"env" json:"env" yaml:"env"`                                     // Environment value
	DbType        string `mapstructure:"db-type" json:"db-type" yaml:"db-type"`                         // Database type: mysql(default)|sqlite|sqlserver|postgresql
	OssType       string `mapstructure:"oss-type" json:"oss-type" yaml:"oss-type"`                     // OSS type
	RouterPrefix  string `mapstructure:"router-prefix" json:"router-prefix" yaml:"router-prefix"`       // Route prefix
	Addr          int    `mapstructure:"addr" json:"addr" yaml:"addr"`                                 // Port value
	LimitCountIP  int    `mapstructure:"iplimit-count" json:"iplimit-count" yaml:"iplimit-count"`       // Limit same IP access count
	LimitTimeIP   int    `mapstructure:"iplimit-time" json:"iplimit-time" yaml:"iplimit-time"`          // Limit time
	UseMultipoint bool   `mapstructure:"use-multipoint" json:"use-multipoint" yaml:"use-multipoint"`    // Multi-point login interception
	UseRedis      bool   `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"`                   // Use redis
	UseMongo      bool   `mapstructure:"use-mongo" json:"use-mongo" yaml:"use-mongo"`                   // Use mongo
	UseStrictAuth bool   `mapstructure:"use-strict-auth" json:"use-strict-auth" yaml:"use-strict-auth"` // Use tree role assignment mode
}

description ​

Configuration NameTypeDescription
envstringEnvironment mode, "develop" for development mode (skip authentication), "public" for production mode
addrintBackend service port, default 8888
db-typestringDatabase type, supports: mysql, pgsql, sqlite, mssql, oracle
oss-typestringObject storage type: local (local storage), qiniu (Qiniu Cloud), aliyun (Alibaba Cloud), minio
local: store to local.path directory
Other types need to configure corresponding parameters
router-prefixstringRoute prefix, used for API route unified prefix
use-multipointboolWhether to enable multi-point login interception (single sign-on), default false
use-redisboolWhether to use Redis cache, default false
iplimit-countintIP rate limiting: maximum access count for same IP within specified time period, default 15000
iplimit-timeintIP rate limiting: limit time window (seconds), default 3600
use-mongoboolWhether to use MongoDB database, default false
use-strict-authboolWhether to enable strict role mode (tree role assignment), default false

captcha ​

yaml ​

yaml
# captcha configuration
captcha:
  key-long: 6
  img-width: 240
  img-height: 80
  open-captcha: 0
  open-captcha-timeout: 3600

struct ​

go
type Captcha struct {
	KeyLong            int `mapstructure:"key-long" json:"key-long" yaml:"key-long"`                                     // Captcha length
	ImgWidth           int `mapstructure:"img-width" json:"img-width" yaml:"img-width"`                                  // Captcha width
	ImgHeight          int `mapstructure:"img-height" json:"img-height" yaml:"img-height"`                               // Captcha height
	OpenCaptcha        int `mapstructure:"open-captcha" json:"open-captcha" yaml:"open-captcha"`                         // Anti-brute force captcha enable count, 0 means captcha required for every login, other numbers represent wrong password count, e.g. 3 means captcha appears after 3 wrong attempts
	OpenCaptchaTimeOut int `mapstructure:"open-captcha-timeout" json:"open-captcha-timeout" yaml:"open-captcha-timeout"` // Anti-brute force captcha timeout, unit: s(seconds)
}

description ​

Configuration NameTypeDescription
key-longintCaptcha length
img-widthintCaptcha width
img-heightintCaptcha height
open-captchaintAnti-brute force captcha enable count, 0 means captcha required for every login, other numbers represent wrong password count
open-captcha-timeoutintAnti-brute force captcha timeout, unit: s(seconds)

Mysql [pgsql,sqlite,mssql,oracle] ​

yaml ​

yaml
# mysql connect configuration
mysql:
  path: ''
  port: ''
  config: ''
  db-name: ''
  username: ''
  password: ''
  prefix: ''
  singular: false
  engine: 'InnoDB'
  max-idle-conns: 10
  max-open-conns: 100
  log-mode: 'info'
  log-zap: false

struct ​

go
type Mysql struct {
    GeneralDB `yaml:",inline" mapstructure:",squash"`
}

type GeneralDB struct {
    Path         string `mapstructure:"path" json:"path" yaml:"path"`
    Port         string `mapstructure:"port" json:"port" yaml:"port"`
    Config       string `mapstructure:"config" json:"config" yaml:"config"`
    Dbname       string `mapstructure:"db-name" json:"db-name" yaml:"db-name"`
    Username     string `mapstructure:"username" json:"username" yaml:"username"`
    Password     string `mapstructure:"password" json:"password" yaml:"password"`
    Prefix       string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
    Singular     bool   `mapstructure:"singular" json:"singular" yaml:"singular"`
    Engine       string `mapstructure:"engine" json:"engine" yaml:"engine" default:"InnoDB"`
    MaxIdleConns int    `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns"`
    MaxOpenConns int    `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"`
    LogMode      string `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode"`
    LogZap       bool   `mapstructure:"log-zap" json:"log-zap" yaml:"log-zap"`
}

description ​

Configuration NameTypeDescription
pathstringDatabase server address
portstringDatabase port
usernamestringDatabase username
passwordstringDatabase password
db-namestringDatabase name
configstringDatabase connection advanced configuration
prefixstringTable name prefix
singularboolWhether to use singular table names
enginestringDatabase engine, default InnoDB
max-idle-connsintSet maximum number of idle connections
max-open-connsintSet maximum number of open connections to database
log-modestringEnable Gorm global log level: "silent", "error", "warn", "info", default info
log-zapboolWhether to write logs to file through zap

struct ​

go
type Pgsql struct {
    GeneralDB `yaml:",inline" mapstructure:",squash"`
}

// GeneralDB struct definition see above Mysql section

description ​

Configuration NameTypeDescription
pathstringDatabase server address
portstringDatabase port
usernamestringDatabase username
passwordstringDatabase password
db-namestringDatabase name
configstringDatabase connection advanced configuration
prefixstringTable name prefix
singularboolWhether to use singular table names
enginestringDatabase engine, default InnoDB
max-idle-connsintSet maximum number of idle connections
max-open-connsintSet maximum number of open connections to database
log-modestringEnable Gorm global log level: "silent", "error", "warn", "info", default info
log-zapboolWhether to write logs to file through zap

Local ​

yaml ​

yaml
# local configuration
local:
  path: 'uploads/file'
  store-path: 'uploads/file'

struct ​

go
type Local struct {
	Path      string `mapstructure:"path" json:"path" yaml:"path"`                   // Local file access path
	StorePath string `mapstructure:"store-path" json:"store-path" yaml:"store-path"` // Local file storage path
}

description ​

Configuration NameTypeDescription
pathstringLocal file access path
store-pathstringLocal file storage path

Qiniu ​

yaml ​

yaml
# qiniu configuration (Please apply for corresponding public key, private key, bucket and domain address from Qiniu)
qiniu:
  zone: 'Your space region'
  bucket: 'Your space name'
  img-path: 'Your OSS domain'
  use-https: false
  access-key: 'xxxxxxxxxxxxxxxxxxxxxxxxx'
  secret-key: 'xxxxxxxxxxxxxxxxxxxxxxxxx'
  use-cdn-domains: false

struct ​

go
type Qiniu struct {
	Zone          string `mapstructure:"zone" json:"zone" yaml:"zone"`
	Bucket        string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	ImgPath       string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
	UseHTTPS      bool   `mapstructure:"use-https" json:"useHttps" yaml:"use-https"`
	AccessKey     string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
	SecretKey     string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
	UseCdnDomains bool   `mapstructure:"use-cdn-domains" json:"useCdnDomains" yaml:"use-cdn-domains"`
}

description ​

Configuration NameTypeDescription
zonestringStorage region Zone, configurable options are ZoneHuadong / ZoneHuabei / ZoneHuanan / ZoneBeimei / ZoneXinjiapo
bucketstringStorage space
img-pathstringCDN acceleration domain
use-httpsboolWhether to use https
access-keystringSecret key AK
secret-keystringSecret key SK
use-cdn-domainsboolWhether to use CDN upload acceleration for uploads

AutoCode ​

yaml ​

yaml
# autocode configuration
autocode:
  web: '/web/src'
  root: ''
  server: '/server'
  module: 'github.com/flipped-aurora/gin-vue-admin/server'
  ai-path: ''

struct ​

go
type Autocode struct {
	Web    string `mapstructure:"web" json:"web" yaml:"web"`
	Root   string `mapstructure:"root" json:"root" yaml:"root"`
	Server string `mapstructure:"server" json:"server" yaml:"server"`
	Module string `mapstructure:"module" json:"module" yaml:"module"`
	AiPath string `mapstructure:"ai-path" json:"ai-path" yaml:"ai-path"`
}

description ​

Configuration NameTypeDescription
webstringFrontend project path
rootstringProject root directory, auto-adapted, please do not configure manually
serverstringServer project path
modulestringGo module name
ai-pathstringAI related path