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

type Server struct {
4
	Mysql       Mysql       `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
5
	Postgresql  Postgresql  `mapstructure:"postgresql" json:"postgresql" yaml:"postgresql"`
6
	Sqlite      Sqlite      `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
7
	Sqlserver   Sqlserver   `mapstructure:"sqlserver" json:"sqlserver" yaml:"sqlserver"`
8 9 10 11 12 13 14
	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"`
	Zap         Zap         `mapstructure:"zap" json:"zap" yaml:"zap"`
15
	LocalUpload LocalUpload `mapstructure:"localUpload" json:"localUpload" yaml:"localUpload"`
M
maplepie 已提交
16
	Email       Email       `mapstructure:"email" json:"email" yaml:"email"`
17 18
}

19
type System struct {
20 21 22 23
	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"`
24
	NeedInitData  bool   `mapstructure:"need-init-data" json:"needInitData" yaml:"need-init-data"`
25 26
	ErrorToEmail  bool   `mapstructure:"error-to-email" json:"errorToEmail" yaml:"error-to-email"`
	ConfigEnv     string `mapstructure:"config-env" json:"configEnv" yaml:"config-env"`
27 28
}

29
type JWT struct {
30
	SigningKey string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`
31 32
}

33
type Casbin struct {
34
	ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
35 36
}

37
type Mysql struct {
38 39 40 41 42 43 44 45
	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"`
46 47
}

48
type Postgresql struct {
Sliver_Horn's avatar
Sliver_Horn 已提交
49
	Host                 string `mapstructure:"host" json:"host" yaml:"host"`
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
	Username             string `mapstructure:"username" json:"username" yaml:"username"`
	Password             string `mapstructure:"password" json:"password" yaml:"password"`
	Dbname               string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
	Port                 string `mapstructure:"port" json:"port" yaml:"port"`
	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"`
	Logger               bool   `mapstructure:"logger" json:"logger" yaml:"logger"`
	PreferSimpleProtocol bool   `mapstructure:"prefer-simple-protocol" json:"preferSimpleProtocol" yaml:"prefer-simple-protocol"`
}

type Sqlite struct {
	Path         string `mapstructure:"path" json:"path" yaml:"path"`
	MaxIdleConns int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	Logger       bool   `mapstructure:"logger" json:"logger" yaml:"logger"`
}

type Sqlserver struct {
	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"`
	MaxIdleConns int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	Logger       bool   `mapstructure:"logger" json:"logger" yaml:"logger"`
}

78
type Redis struct {
79 80 81
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
82
}
83 84

type LocalUpload struct {
85 86
	Local    bool   `mapstructure:"local" json:"local" yaml:"local"`
	FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
87 88
}

89
type Qiniu struct {
90 91
	AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
	SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
L
Leonard Wang 已提交
92 93
	Bucket    string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	ImgPath   string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
94 95
}

96
type Captcha struct {
97 98 99
	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"`
100 101
}

102
type Zap struct {
103 104 105 106
	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"`
107 108 109 110 111
	LinkName      string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
	ShowLine      bool   `mapstructure:"show-line" json:"showLine" yaml:"showLine"`
	EncodeLevel   string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
	LogInConsole  bool   `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
112
}
M
maplepie 已提交
113 114

type Email struct {
115 116 117 118 119 120 121
	EmailFrom     string `mapstructure:"email-from" json:"emailFrom" yaml:"email-from"`
	EmailNickname string `mapstructure:"email-nickname" json:"emailNickname" yaml:"email-nickname"`
	EmailSecret   string `mapstructure:"email-secret" json:"emailSecret" yaml:"email-secret"`
	EmailTo       string `mapstructure:"email-to" json:"emailTo" yaml:"email-to"`
	EmailHost     string `mapstructure:"email-host" json:"emailHost" yaml:"email-host"`
	EmailPort     int    `mapstructure:"email-port" json:"emailPort" yaml:"email-port"`
	EmailIsSSL    bool   `mapstructure:"email-is-ssl" json:"emailIsSSL" yaml:"email-is-ssl"`
M
maplepie 已提交
122
}