Documentation
¶
Index ¶
- func CORSCfg() cors
- func CacheCfg() map[string]cache
- func CaptchaCfg() captcha
- func Custom[T any]() (T, error)
- func DBCfg() map[string]DB
- func FileCfg() map[string]File
- func Get(path string) any
- func LogCfg() log
- func ServerCfg() server
- func SetConfigPath(path string)
- type AliyunOSS
- type AwsS3
- type CORSWhitelist
- type DB
- type File
- type JWT
- type Local
- type Qiniu
- type TencentCOS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptchaCfg ¶
func CaptchaCfg() captcha
func SetConfigPath ¶
func SetConfigPath(path string)
Types ¶
type AliyunOSS ¶
type AliyunOSS struct {
Endpoint string `json:"endpoint" yaml:"endpoint"`
AccessKeyId string `json:"accessKeyId" yaml:"accessKeyId"`
AccessKeySecret string `json:"accessKeySecret" yaml:"accessKeySecret"`
BucketName string `json:"bucketName" yaml:"bucketName"`
BucketUrl string `json:"bucketUrl" yaml:"bucketUrl"`
BasePath string `json:"basePath" yaml:"basePath"`
}
type AwsS3 ¶
type AwsS3 struct {
Bucket string `json:"bucket" yaml:"bucket"`
Region string `json:"region" yaml:"region"`
Endpoint string `json:"endpoint" yaml:"endpoint"`
S3ForcePathStyle bool `json:"s3ForcePathStyle" yaml:"s3ForcePathStyle"`
DisableSSL bool `json:"disableSsl" yaml:"disableSsl"`
SecretID string `json:"secretId" yaml:"secretId"`
SecretKey string `json:"secretKey" yaml:"secretKey"`
BaseURL string `json:"baseUrl" yaml:"baseUrl"`
PathPrefix string `json:"pathPrefix" yaml:"pathPrefix"`
}
type CORSWhitelist ¶
type CORSWhitelist struct {
AllowOrigin string `json:"allowOrigin" yaml:"allowOrigin"`
AllowMethods string `json:"allowMethods" yaml:"allowMethods"`
AllowHeaders string `json:"allowHeaders" yaml:"allowHeaders"`
ExposeHeaders string `json:"exposeHeaders" yaml:"exposeHeaders"`
AllowCredentials bool `json:"allowCredentials" yaml:"allowCredentials"`
}
type DB ¶
type DB struct {
Driver string `json:"driver" yaml:"driver"` // 驱动
Path string `json:"path" yaml:"path"` // 服务器地址
Port string `json:"port" yaml:"port"` //端口
Config string `json:"config" yaml:"config"` // 高级配置
Dbname string `json:"dbname" yaml:"dbname"` // 数据库名
Username string `json:"username" yaml:"username"` // 数据库用户名
Password string `json:"password" yaml:"password"` // 数据库密码
Prefix string `json:"prefix" yaml:"prefix"` //全局表前缀,单独定义TableName则不生效
Singular bool `json:"singular" yaml:"singular"` //是否开启全局禁用复数,true表示开启
MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns"` // 空闲中的最大连接数
MaxOpenConns int `json:"maxOpenConns" yaml:"maxOpenConns"` // 打开到数据库的最大连接数
LogMode int `json:"logMode" yaml:"logMode"` // 日志等级 Silent:1;Error:2;Warn:3;Info:4
}
type File ¶
type File struct {
Name string `json:"name" yaml:"name"`
Driver string `json:"driver" yaml:"driver"` // 类型 cos:腾讯云COS; oss:阿里云OSS; local:本地文件存储;
Bucket string `json:"bucket" yaml:"bucket"` // 储存桶
Region string `json:"region" yaml:"region"` // 地域: 腾讯:region; 阿里:Endpoint;
ID string `json:"id" yaml:"id"` // id
Key string `json:"key" yaml:"key"` // key
PrefixPath string `json:"prefixPath" yaml:"prefixPath"` // 文件访问前缀
StorePath string `json:"storePath" yaml:"storePath"` // 本地文件存储路径(类型为local时必填)
CdnURL string `json:"cdnUrl" yaml:"cdnUrl"` // 文件访问CND域名
Limit float64 `json:"limit" yaml:"limit"`
Style string `json:"style" yaml:"style"`
}
type JWT ¶
type Qiniu ¶
type Qiniu struct {
Zone string `json:"zone" yaml:"zone"` // 存储区域
Bucket string `json:"bucket" yaml:"bucket"` // 空间名称
ImgPath string `json:"imgPath" yaml:"imgPath"` // CDN加速域名
UseHTTPS bool `json:"useHttps" yaml:"useHttps"` // 是否使用https
AccessKey string `json:"accessKey" yaml:"accessKey"` // 秘钥AK
SecretKey string `json:"secretKey" yaml:"secretKey"` // 秘钥SK
UseCdnDomains bool `json:"useCdnDomains" yaml:"useCdnDomains"` // 上传是否使用CDN上传加速
}
type TencentCOS ¶
type TencentCOS struct {
Bucket string `json:"bucket" yaml:"bucket"` // 储存桶
Region string `json:"region" yaml:"region"` // 地域
SecretID string `json:"secretId" yaml:"secretId"` // id
SecretKey string `json:"secretKey" yaml:"secretKey"` // key
BaseURL string `json:"baseUrl" yaml:"baseUrl"` // 文件访问CND域名
}
Click to show internal directories.
Click to hide internal directories.