config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VarPath  string = "var"
	LogPath         = VarPath + "/logs"
	TempPath        = VarPath + "/tmp"
)
View Source
const (
	FiveMB    int64 = 5 * 1024 * 1024   // 5MB
	TwentyMB  int64 = 20 * 1024 * 1024  // 20MB
	HundredMB int64 = 100 * 1024 * 1024 // 100MB
)

Variables

View Source
var AmsFileAllow = struct {
	Image      FileAllow
	Audio      FileAllow
	Video      FileAllow
	RewardFile FileAllow
}{
	Image:      FileAllow{AllowMimeType: []string{"png", "jpg", "jpeg", "gif", "bmp"}, AllowCapacitySize: FiveMB},
	Audio:      FileAllow{AllowMimeType: []string{"mp3", "wav", "flac", "mid", "mov", "m4a"}, AllowCapacitySize: TwentyMB},
	Video:      FileAllow{AllowMimeType: []string{"mp4", "mpg", "avi", "wmv", "mov", "flv", "rmvb", "3gp", "m4v", "mkv"}, AllowCapacitySize: HundredMB},
	RewardFile: FileAllow{AllowMimeType: []string{"xlsx", "xls"}, AllowCapacitySize: FiveMB},
}

AmsFileAllow 管理端上传限制

View Source
var AnonymousFileAllow = struct {
	File FileAllow
}{
	File: FileAllow{AllowMimeType: []string{"pdf", "doc", "docx", "ppt", "pptx", "xls", "xlsx"}, AllowCapacitySize: TwentyMB},
}

AnonymousFileAllow 匿名用户上传限制

View Source
var App *appConfig
View Source
var Cache *cache
View Source
var Database *database
View Source
var Etcd *etcd
View Source
var Filesystem *filesystem
View Source
var MessageQueue *messageQueue
View Source
var Monitor *monitor
View Source
var Redis *redis
View Source
var Server *serverConfig
View Source
var ThirdParty *thirdParty
View Source
var UserFileAllow = struct {
	Image FileAllow
	Audio FileAllow
	Video FileAllow
}{
	Image: FileAllow{AllowMimeType: []string{"png", "jpg", "jpeg", "gif"}, AllowCapacitySize: FiveMB},
	Audio: FileAllow{AllowMimeType: []string{"mp3", "wav", "flac", "mid", "mov", "m4a"}, AllowCapacitySize: TwentyMB},
	Video: FileAllow{AllowMimeType: []string{"mp4", "mpg", "avi", "wmv", "mov", "flv", "rmvb", "3gp", "m4v", "mkv"}, AllowCapacitySize: HundredMB},
}

UserFileAllow 终端用户上传限制

Functions

func Load

func Load()

Types

type Env

type Env string

Env 应用环境

const (
	// Prod 生产环境
	Prod Env = "prod"
	// Test 测试环境
	Test Env = "test"
	// Dev 开发环境
	Dev Env = "dev"
)

func (Env) String

func (e Env) String() string

func (Env) Valid

func (e Env) Valid() bool

type FileAllow

type FileAllow struct {
	// 允许上传的文件类型
	AllowMimeType []string
	// 允许上传的文件容量大小(单位:字节)
	AllowCapacitySize int64
}

Jump to

Keyboard shortcuts

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