config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 10 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"`
	Register   Register `json:"register"`
	JuheKey    string   `json:"juhe_key"`
	JuheUrl    string   `json:"juhe_url"`
	AdminEmail []string `json:"admin_email"`
	Debug      bool     `json:"debug"`
}

type Config

type Config struct {
	Core               Core       `json:"core"`
	AdminServerAddress string     `json:"admin_server_address"`
	App                App        `json:"app"`
	Http               Http       `json:"http"`
	Email              Email      `json:"email"`
	Statistics         Statistics `json:"statistics"`
	Error              Error      `json:"error"`
	Debug              bool       `json:"debug"`
}

配置信息

var Cfg *Config

type Core added in v0.3.0

type Core struct {
	ChannelPrefix string `json:"channel_prefix"`
}

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 Error added in v0.5.0

type Error struct {
	ShieldUser []string `json:"shield_user"`
}

type Http

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

type Register added in v0.4.0

type Register struct {
	SupportEmailSuffix []string      `json:"support_email_suffix"`
	GrantQuota         int           `json:"grant_quota"`
	QuotaExpiresAt     time.Duration `json:"quota_expires_at"`
}

type Statistics added in v0.5.0

type Statistics struct {
	Cron        string        `json:"cron"`
	Days        int           `json:"days"`
	Limit       int64         `json:"limit"`
	LockMinutes time.Duration `json:"lock_minutes"`
}

统计

Jump to

Keyboard shortcuts

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