config

package
v0.0.0-...-997d260 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aliyun

type Aliyun struct {
	Endpoint        string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	BasePath        string `mapstructure:"base-path" json:"basePath" yaml:"base-path"`
	BucketUrl       string `mapstructure:"bucket-url" json:"bucketUrl" yaml:"bucket-url"`
	BucketName      string `mapstructure:"bucket-name" json:"bucketName" yaml:"bucket-name"`
	AccessKeyId     string `mapstructure:"access-key-id" json:"accessKeyId" yaml:"access-key-id"`
	AccessKeySecret string `mapstructure:"access-key-secret" json:"accessKeySecret" yaml:"access-key-secret"`
}

func (*Aliyun) Filepath

func (a *Aliyun) Filepath(filename string) string

type Captcha

type Captcha struct {
	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"`        // 验证码高度
	Verification bool `mapstructure:"verification" json:"verification" yaml:"verification"` // 验证码开启
}

type Casbin

type Casbin struct {
	ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"` // 存放casbin模型的相对路径
}

type Casdoor

type Casdoor struct {
	Endpoint     string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	ClientId     string `mapstructure:"clientId" json:"clientId" yaml:"clientId"`
	ClientSecret string `mapstructure:"clientSecret" json:"clientSecret" yaml:"clientSecret"`
	Organization string `mapstructure:"organization" json:"organization" yaml:"organization"`
	Application  string `mapstructure:"application" json:"application" yaml:"application"`
	JwtPublicKey string `mapstructure:"jwtPublicKey" json:"jwtPublicKey" yaml:"jwtPublicKey"`
}

type Config

type Config struct {
	Jwt     Jwt     `mapstructure:"jwt" json:"jwt" yaml:"jwt"`             // jwt
	Zap     Zap     `mapstructure:"zap" json:"zap" yaml:"zap"`             // zap 日志
	Gorm    Gorm    `mapstructure:"gorm" json:"gorm" yaml:"gorm"`          // gorm
	Redis   Redis   `mapstructure:"redis" json:"redis" yaml:"redis"`       // redis
	Email   Email   `mapstructure:"email" json:"email" yaml:"email"`       // email 邮箱
	System  System  `mapstructure:"system" json:"system" yaml:"system"`    // system 系统
	Casbin  Casbin  `mapstructure:"casbin" json:"casbin" yaml:"casbin"`    // casbin 权限
	Casdoor Casdoor `mapstructure:"casdoor" json:"casdoor" yaml:"casdoor"` // casdoor 认证
	Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"` // captcha 验证码

	Qiniu     Qiniu     `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`                 // 七牛云对象存储
	Local     Local     `mapstructure:"local" json:"local" yaml:"local"`                 // 本地
	Minio     Minio     `mapstructure:"minio" json:"minio" yaml:"minio"`                 // minio对象存储
	Aliyun    Aliyun    `mapstructure:"aliyun" json:"aliyun" yaml:"aliyun"`              // 阿里云对象存储
	Tencent   Tencent   `mapstructure:"tencent" json:"tencent" yaml:"tencent"`           // 腾讯对象存储
	HuaWeiObs HuaWeiObs `mapstructure:"hua-wei-obs" json:"huaWeiObs" yaml:"hua-wei-obs"` // 华为云对象存储
}

type Email

type Email struct {
	To       string `mapstructure:"to" json:"to" yaml:"to"`                   // 收件人:多个以英文逗号分隔 例:a@qq.com b@qq.com 正式开发中请把此项目作为参数使用
	From     string `mapstructure:"from" json:"from" yaml:"from"`             // 发件人  你自己要发邮件的邮箱
	Host     string `mapstructure:"host" json:"host" yaml:"host"`             // 服务器地址 例如 smtp.qq.com  请前往QQ或者你要发邮件的邮箱查看其smtp协议
	Secret   string `mapstructure:"secret" json:"secret" yaml:"secret"`       // 密钥    用于登录的密钥 最好不要用邮箱密码 去邮箱smtp申请一个用于登录的密钥
	Nickname string `mapstructure:"nickname" json:"nickname" yaml:"nickname"` // 昵称    发件人昵称 通常为自己的邮箱
	Port     int    `mapstructure:"port" json:"port" yaml:"port"`             // 端口     请前往QQ或者你要发邮件的邮箱查看其smtp协议 大多为 465
	IsSSL    bool   `mapstructure:"is-ssl" json:"isSSL" yaml:"is-ssl"`        // 是否SSL   是否开启SSL
}

type Gorm

type Gorm struct {
	Dsn             Dsn           `mapstructure:"dsn" json:"dns" yaml:"dsn"`
	Config          string        `mapstructure:"config" json:"config" yaml:"config"`
	LogZap          bool          `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
	LogMode         string        `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
	AutoMigrate     bool          `mapstructure:"auto-migrate" json:"autoMigrate" yaml:"auto-migrate"`
	MaxIdleConnes   int           `mapstructure:"max-idle-connes" json:"maxIdleConnes" yaml:"max-idle-connes"`
	MaxOpenConnes   int           `mapstructure:"max-open-connes" json:"maxOpenConnes" yaml:"max-open-connes"`
	ConnMaxLifetime time.Duration `mapstructure:"conn-max-lifetime" json:"connMaxLifetime" yaml:"conn-max-lifetime"`
	ConnMaxIdleTime time.Duration `mapstructure:"conn-max-idle-time" json:"connMaxIdleTime" yaml:"conn-max-idle-time"`
}

func (*Gorm) GetConnMaxIdleTime

func (g *Gorm) GetConnMaxIdleTime() time.Duration

GetConnMaxIdleTime 获取 ConnMaxIdleTime 值, 局部不为0则取局部, 为0则取全局 Author: SliverHorn

func (*Gorm) GetConnMaxLifetime

func (g *Gorm) GetConnMaxLifetime() time.Duration

GetConnMaxLifetime 获取 ConnMaxLifetime 值, 局部不为0则取局部, 为0则取全局 Author: SliverHorn

func (*Gorm) GetMaxIdleConnes

func (g *Gorm) GetMaxIdleConnes() int

GetMaxIdleConnes 获取 MaxIdleConnes 值, 局部不为0则取局部, 为0则取全局 Author: SliverHorn

func (*Gorm) GetMaxOpenConnes

func (g *Gorm) GetMaxOpenConnes() int

GetMaxOpenConnes 获取 MaxOpenConnes 值, 局部不为0则取局部, 为0则取全局 Author: SliverHorn

type HuaWeiObs

type HuaWeiObs struct {
	Path      string `mapstructure:"path" json:"path" yaml:"path"`
	Bucket    string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	Endpoint  string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
	SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
}

type Jwt

type Jwt struct {
	SigningKey  string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`    // 签名
	BufferTime  int64  `mapstructure:"buffer-time" json:"bufferTime" yaml:"buffer-time"`    // 缓冲时间
	ExpiresTime int64  `mapstructure:"expires-time" json:"expiresTime" yaml:"expires-time"` // 过期时间
}

type Local

type Local struct {
	Path string `mapstructure:"path" json:"path" yaml:"path"` // 本地文件路径
}

func (*Local) Filename

func (l *Local) Filename(filename string) string

func (*Local) Filepath

func (l *Local) Filepath(filename string) string

type Minio

type Minio struct {
	Id       string `mapstructure:"id" json:"id" yaml:"id"`
	Path     string `mapstructure:"path" json:"path" yaml:"path"`
	Token    string `mapstructure:"token" json:"token" yaml:"token"`
	Bucket   string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	Secret   string `mapstructure:"secret" json:"secret" yaml:"secret"`
	Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`

	UseSsl bool `mapstructure:"use-ssl" json:"useSsl" yaml:"use-ssl"`
}

func (*Minio) Filename

func (m *Minio) Filename(filename string) string

func (*Minio) Filepath

func (m *Minio) Filepath(filename string) string

type Qiniu

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"`                     // CDN加速域名
	UseHTTPS      bool   `mapstructure:"use-https" json:"useHttps" yaml:"use-https"`                  // 是否使用https
	AccessKey     string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`               // 秘钥AK
	SecretKey     string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`               // 秘钥SK
	UseCdnDomains bool   `mapstructure:"use-cdn-domains" json:"useCdnDomains" yaml:"use-cdn-domains"` // 上传是否使用CDN上传加速
}

func (*Qiniu) GetConfig

func (q *Qiniu) GetConfig() *storage.Config

func (*Qiniu) GetZone

func (q *Qiniu) GetZone() *storage.Region

type Redis

type Redis struct {
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`                   // redis的哪个数据库
	Addr     string `mapstructure:"addr" json:"addr" yaml:"addr"`             // 服务器地址:端口
	Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
}

type System

type System struct {
	Env           string `mapstructure:"env" json:"env" yaml:"env"`                                 // 环境值
	OssType       string `mapstructure:"oss-type" json:"ossType" yaml:"oss-type"`                   // Oss类型
	UseMultipoint bool   `mapstructure:"use-multipoint" json:"useMultipoint" yaml:"use-multipoint"` // 多点登录拦截
}

type Tencent

type Tencent struct {
	Bucket     string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	Region     string `mapstructure:"region" json:"region" yaml:"region"`
	BaseURL    string `mapstructure:"base-url" json:"baseURL" yaml:"base-url"`
	SecretID   string `mapstructure:"secret-id" json:"secretID" yaml:"secret-id"`
	SecretKey  string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
	PathPrefix string `mapstructure:"path-prefix" json:"pathPrefix" yaml:"path-prefix"`
}

func (*Tencent) Filename

func (t *Tencent) Filename(filename string) string

func (*Tencent) Filepath

func (t *Tencent) Filepath(filename string) string

type Zap

type Zap struct {
	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"`                // 软链接名称
	EncodeLevel   string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`       // 编码级
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"` // 栈名
	ShowLine      bool   `mapstructure:"show-line" json:"showLine" yaml:"showLine"`                 // 显示行
	LogInConsole  bool   `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`  // 输出控制台
}

func (*Zap) GetZapLevel

func (z *Zap) GetZapLevel() zapcore.Level

GetZapLevel 初始化配置文件的Level Author SliverHorn

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL