configs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinGoVersion 最小 Go 版本
	MinGoVersion = 1.16

	// ProjectVersion 项目版本
	ProjectVersion = "v0.0.1"

	// ProjectName 项目名称
	ProjectName = "mall-go"

	// ProjectDomain 项目域名
	ProjectDomain = "http://127.0.0.1"

	// ProjectPort 项目端口
	ProjectPort    = ":8080"
	MallAdminPort  = ":8080"
	MallPortalPort = ":8085"

	// ProjectLogFile 项目访问日志存放文件
	ProjectLogFile          = "./logs/" + ProjectName
	ProjectLogRotateMaxDays = 7
	ProjectLogLevel         = "info"

	// ProjectCronLogFile 项目后台任务日志存放文件
	ProjectCronLogFile = "./logs/" + ProjectName + "-cron.log"

	// ProjectInstallMark 项目安装完成标识
	ProjectInstallMark = "INSTALL.lock"

	// HeaderLoginToken 登录验证 Token,Header 中传递的参数
	HeaderLoginToken = "Token"

	// HeaderSignToken 签名验证 Authorization,Header 中传递的参数
	HeaderSignToken = "Authorization"

	// HeaderSignTokenDate 签名验证 Date,Header 中传递的参数
	HeaderSignTokenDate = "Authorization-Date"

	// HeaderSignTokenTimeout 签名有效期为 2 分钟
	HeaderSignTokenTimeout = time.Minute * 2

	// RedisKeyPrefixLoginUser Redis Key 前缀 - 登录用户信息
	RedisKeyPrefixLoginUser = ProjectName + ":login-user:"

	// RedisKeyPrefixSignature Redis Key 前缀 - 签名验证信息
	RedisKeyPrefixSignature = ProjectName + ":signature:"

	// ZhCN 简体中文 - 中国
	ZhCN = "zh-cn"

	// EnUS 英文 - 美国
	EnUS = "en-us"

	// MaxRequestsPerSecond 每秒最大请求量
	MaxRequestsPerSecond = 10000

	// LoginSessionTTL 登录有效期为 24 小时
	LoginSessionTTL = time.Hour * 24
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MySQL struct {
		Read struct {
			Addr string `toml:"addr"`
			User string `toml:"user"`
			Pass string `toml:"pass"`
			Name string `toml:"name"`
		} `toml:"read"`
		Write struct {
			Addr string `toml:"addr"`
			User string `toml:"user"`
			Pass string `toml:"pass"`
			Name string `toml:"name"`
		} `toml:"write"`
		Base struct {
			MaxOpenConn     int           `toml:"maxOpenConn"`
			MaxIdleConn     int           `toml:"maxIdleConn"`
			ConnMaxLifeTime time.Duration `toml:"connMaxLifeTime"`
		} `toml:"base"`
	} `toml:"mysql"`

	MongoDB struct {
		Host     string `toml:"host"`
		Port     int    `toml:"port"`
		Database string `toml:"database"`
	}

	Redis struct {
		Addr         string `toml:"addr"`
		Pass         string `toml:"pass"`
		Db           int    `toml:"db"`
		MaxRetries   int    `toml:"maxRetries"`
		PoolSize     int    `toml:"poolSize"`
		MinIdleConns int    `toml:"minIdleConns"`
		Database     string `toml:"database"`
		Key          struct {
			Admin        string `toml:"admin"`
			ResourceList string `toml:"resourceList"`
			AuthCode     string `toml:"authCode"`
			OrderId      string `toml:"orderId"`
			Member       string `toml:"member"`
		} `toml:"key"`
		Expire struct {
			Common   int64 `toml:"common"`
			AuthCode int64 `toml:"authCode"`
		} `toml:"expire"`
	} `toml:"redis"`

	Mail struct {
		Host string `toml:"host"`
		Port int    `toml:"port"`
		User string `toml:"user"`
		Pass string `toml:"pass"`
		To   string `toml:"to"`
	} `toml:"mail"`

	HashIds struct {
		Secret string `toml:"secret"`
		Length int    `toml:"length"`
	} `toml:"hashids"`

	Language struct {
		Local string `toml:"local"`
	} `toml:"language"`

	Jwt struct {
		TokenHeader string `toml:"tokenHeader"`
		Secret      string `toml:"secret"`
		Expiration  int64  `toml:"expiration"`
		TokenHead   string `toml:"tokenHead"`
	} `toml:"jwt"`

	Minio struct {
		Endpoint   string `toml:"endpoint"`
		BucketName string `toml:"bucketName"`
		AccessKey  string `toml:"accessKey"`
		SecretKey  string `toml:"secretKey"`
	} `toml:"minio"`

	Rabbitmq struct {
		Host        string `toml:"host"`
		Port        int64  `toml:"port"`
		VirtualHost string `toml:"virtualHost"`
		Username    string `toml:"username"`
		Password    string `toml:"password"`
	} `toml:"rabbitmq"`

	Alipay struct {
		GatewayUrl      string `toml:"gatewayUrl"`
		AppId           string `toml:"appId"`
		AlipayPublicKey string `toml:"alipayPublicKey"`
		AppPrivateKey   string `toml:"appPrivateKey"`
		ApiAESKey       string `toml:"apiAESKey"`
		ReturnUrl       string `toml:"returnUrl"`
		NotifyUrl       string `toml:"notifyUrl"`
	}
}

func Get

func Get() Config

Jump to

Keyboard shortcuts

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