config.go 4.2 KB
Newer Older
1 2 3
package config

type Server struct {
G
Granty1 已提交
4 5 6 7 8 9 10 11 12
	Mysql     Mysql     `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
	Sqlite    Sqlite    `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
	Qiniu     Qiniu     `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
	Casbin    Casbin    `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
	Redis     Redis     `mapstructure:"redis" json:"redis" yaml:"redis"`
	System    System    `mapstructure:"system" json:"system" yaml:"system"`
	JWT       JWT       `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
	Captcha   Captcha   `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
	Log       Log       `mapstructure:"log" json:"log" yaml:"log"`
13
	Zap    	  Zap       `mapstructure:"zap" json:"zap" yaml:"zap"`
14
	LocalUpload LocalUpload `mapstructure:"localUpload" json:"localUpload" yaml:"localUpload"`
15 16
}

17
type System struct {
18 19 20 21
	UseMultipoint bool   `mapstructure:"use-multipoint" json:"useMultipoint" yaml:"use-multipoint"`
	Env           string `mapstructure:"env" json:"env" yaml:"env"`
	Addr          int    `mapstructure:"addr" json:"addr" yaml:"addr"`
	DbType        string `mapstructure:"db-type" json:"dbType" yaml:"db-type"`
22 23
}

24
type JWT struct {
25
	SigningKey string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`
26 27
}

28
type Casbin struct {
29
	ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
30 31
}

32
type Mysql struct {
33 34 35 36 37 38 39 40
	Username     string `mapstructure:"username" json:"username" yaml:"username"`
	Password     string `mapstructure:"password" json:"password" yaml:"password"`
	Path         string `mapstructure:"path" json:"path" yaml:"path"`
	Dbname       string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
	Config       string `mapstructure:"config" json:"config" yaml:"config"`
	MaxIdleConns int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	LogMode      bool   `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
41 42
}

43
type Redis struct {
44 45 46
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
47
}
48 49 50 51 52 53 54

type LocalUpload struct {
	Local bool `mapstructure:"local" json:"local" yaml:"local"`
	AvatarPath string `mapstructure:"avatar-path" json:"avatarPath" yaml:"avatar-path"`
	FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
}

55
type Qiniu struct {
56 57
	AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
	SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
L
Leonard Wang 已提交
58 59
	Bucket    string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	ImgPath   string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
60 61
}

62
type Captcha struct {
63 64 65
	KeyLong   int `mapstructure:"key-long" json:"keyLong" yaml:"key-long"`
	ImgWidth  int `mapstructure:"img-width" json:"imgWidth" yaml:"img-width"`
	ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"`
66 67 68
}

type Log struct {
69 70 71 72
	Prefix  string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	LogFile bool   `mapstructure:"log-file" json:"logFile" yaml:"log-file"`
	Stdout  string `mapstructure:"stdout" json:"stdout" yaml:"stdout"`
	File    string `mapstructure:"file" json:"file" yaml:"file"`
73
}
R
rikugun 已提交
74 75

type Sqlite struct {
76 77 78 79 80
	Username string `mapstructure:"username" json:"username" yaml:"username"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	Path     string `mapstructure:"path" json:"path" yaml:"path"`
	Config   string `mapstructure:"config" json:"config" yaml:"config"`
	LogMode  bool   `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
R
rikugun 已提交
81
}
82 83

type Zap struct {
84 85 86 87 88 89 90
	Level        string `mapstructure:"level" json:"level" yaml:"level"`
	Format       string `mapstructure:"format" json:"format" yaml:"format"`
	Prefix       string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Director     string `mapstructure:"director" json:"director"  yaml:"director"`
	LinkName     string `mapstructure:"link_name" json:"linkName" yaml:"link_name"`
	ShowLine     bool   `mapstructure:"show_line" json:"show_line" yaml:"show_line"`
	LogInConsole bool   `mapstructure:"log_in_console" json:"logInConsole" yaml:"log_in_console"`
91
}