config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, pattern string, def ...interface{}) (*gvar.Var, error)

func GetBool

func GetBool(ctx context.Context, pattern string, def ...interface{}) (bool, error)

func GetInt

func GetInt(ctx context.Context, pattern string, def ...interface{}) int

func GetMapStrStr

func GetMapStrStr(ctx context.Context, pattern string, def ...interface{}) map[string]string

func GetString

func GetString(ctx context.Context, pattern string, def ...interface{}) string

Types

type App

type App struct {
	Env        string   `json:"env"`
	Debug      bool     `json:"debug"`
	JuheKey    string   `json:"juhe_key"`
	JuheUrl    string   `json:"juhe_url"`
	AdminEmail []string `json:"admin_email"`
}

type Config

type Config struct {
	App        *App        `json:"app"`
	Jwt        *Jwt        `json:"jwt"`
	Filesystem *Filesystem `json:"filesystem"`
	Email      *Email      `json:"email"`
	Http       *Http       `json:"http"`
	Vip        *Vip        `json:"vip"`
	// contains filtered or unexported fields
}

配置信息

var Cfg *Config

func (*Config) ServerId

func (c *Config) ServerId() string

服务运行ID

type CosSystem

type CosSystem struct {
	SecretId  string `json:"secret_id"`
	SecretKey string `json:"secret_key"`
	Bucket    string `json:"bucket"`
	Region    string `json:"region"`
}

腾讯云 COS 文件存储

type Email

type Email struct {
	Host     string `json:"host"`     // smtp.xxx.com
	Port     int    `json:"port"`     // 端口号
	UserName string `json:"username"` // 登录账号
	Password string `json:"password"` // 登录密码
	FromName string `json:"fromname"` // 发送人名称
}

邮件配置信息

type Filesystem

type Filesystem struct {
	Default string      `json:"default"`
	Local   LocalSystem `json:"local"`
	Oss     OssSystem   `json:"oss"`
	Qiniu   QiniuSystem `json:"qiniu"`
	Cos     CosSystem   `json:"cos"`
}

type Http added in v1.1.0

type Http struct {
	Timeout   time.Duration `json:"timeout"`
	ProxyOpen bool          `json:"proxy_open"`
	ProxyUrl  string        `json:"proxy_url"`
}

type Jwt

type Jwt struct {
	Secret      string `json:"secret"`       // Jwt 秘钥
	ExpiresTime int64  `json:"expires_time"` // 过期时间(单位秒)
	BufferTime  int64  `json:"buffer_time"`  // 缓冲时间(单位秒)
}

Jwt相关配置信息

type LocalSystem

type LocalSystem struct {
	Root   string `json:"root"`
	Domain string `json:"domain"`
}

本地存储

type OssSystem

type OssSystem struct {
	AccessID     string `json:"access_id"`
	AccessSecret string `json:"access_secret"`
	Bucket       string `json:"bucket"`
	Endpoint     string `json:"endpoint"`
}

阿里云 OSS 文件存储

type QiniuSystem

type QiniuSystem struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Bucket    string `json:"bucket"`
	Domain    string `json:"domain"`
}

七牛云文件存储

type Vip added in v1.1.0

type Vip struct {
	InitDailyCron string `json:"init_daily_cron"`
}

Jump to

Keyboard shortcuts

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