config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSCfg

func CORSCfg() cors

func CacheCfg

func CacheCfg() map[string]cache

func CaptchaCfg

func CaptchaCfg() captcha

func Custom

func Custom[T any]() (T, error)

func DBCfg

func DBCfg() map[string]DB

func FileCfg

func FileCfg() map[string]File

func Get

func Get(path string) any

func LogCfg

func LogCfg() log

func ServerCfg

func ServerCfg() server

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 JWT struct {
	SigningKey  string `json:"signingKey" yaml:"signingKey"`   // jwt签名
	ExpiresTime string `json:"expiresTime" yaml:"expiresTime"` // 过期时间
	BufferTime  string `json:"bufferTime" yaml:"bufferTime"`   // 缓冲时间
	Issuer      string `json:"issuer" yaml:"issuer"`           // 签发者
}

func JwtCfg

func JwtCfg() JWT

type Local

type Local struct {
	Path      string `json:"path" yaml:"path"`           // 本地文件访问路径
	StorePath string `json:"storePath" yaml:"storePath"` // 本地文件存储路径
}

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域名
}

Jump to

Keyboard shortcuts

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