config

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 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"`
	Redis      *Redis      `json:"redis"`
	Jwt        *Jwt        `json:"jwt"`
	Filesystem *Filesystem `json:"filesystem"`
	Email      *Email      `json:"email"`
	// 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.163.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 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 Redis

type Redis struct {
	Host     string `json:"host"`     // 服务器IP地址
	Port     int    `json:"port"`     // 服务器端口号
	Auth     string `json:"auth"`     // 服务器端口号
	Database int    `json:"database"` // 数据库
}

Jump to

Keyboard shortcuts

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