config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfEnv string

ConfEnv env环境变量

View Source
var Whitelist = []string{
	"*",
}

Functions

This section is empty.

Types

type Amqp

type Amqp struct {
	Host     string `yaml:"host" default:"127.0.0.1"`
	Port     string `yaml:"port" default:"5672"`
	User     string `yaml:"user" default:"guest"`
	Password string `yaml:"password" default:""`
	Vhost    string `yaml:"vhost" default:""`
}

type Conf

type Conf struct {
	Server Server `yaml:"server"`
	Jwt    Jwt    `yaml:"jwt"`
	Log    Log    `yaml:"log"`
	Mysql  Mysql  `yaml:"mysql"`
	Redis  Redis  `yaml:"redis"`
	Amqp   Amqp   `yaml:"amqp"`
	Oss    Oss    `yaml:"oss"`
}

func InitConfig

func InitConfig() (*Conf, error)

InitConfig 初始化配置

type Jwt

type Jwt struct {
	TokenExpire int64  `yaml:"tokenExpire" default:"864000"`
	TokenKey    string `yaml:"tokenKey" default:"Authorization"`
	TokenIssuer string `yaml:"tokenIssuer" default:"gin-framework"`
	Secret      string `yaml:"secret"`
}

type Log

type Log struct {
	Debug    bool   `yaml:"debug" default:"true"`
	FileName string `yaml:"fileName" default:"gin-framework"`
	DirPath  string `yaml:"dirPath" default:"runtime/logs"`
}

type Mysql

type Mysql []struct {
	Host         string          `yaml:"host" default:"127.0.0.1"`
	Port         string          `yaml:"port" default:"3306"`
	User         string          `yaml:"user" default:"root"`
	Password     string          `yaml:"password" default:"123456"`
	DbName       string          `yaml:"dbname"`
	Prefix       string          `yaml:"prefix" default:""`
	MaxIdleConns int             `yaml:"maxIdleConns" default:"10"`
	MaxOpenConns int             `yaml:"maxOpenConns" default:"100"`
	MaxLifeTime  int             `yaml:"maxLifeTime" default:"60"`
	LogLevel     logger.LogLevel `yaml:"logLevel" default:"1"`
}

type Oss

type Oss struct {
	EndPoint        string `yaml:"endPoint" default:"https://oss-cn-shanghai.aliyuncs.com"`
	AccessKeyId     string `yaml:"accessKeyId"`
	AccessKeySecret string `yaml:"accessKeySecret"`
	BucketName      string `yaml:"bucketName"`
}

type Redis

type Redis struct {
	Host        string `yaml:"host" default:"127.0.0.1"`
	Port        string `yaml:"port" default:"6379"`
	Password    string `yaml:"password"`
	DbNum       int    `yaml:"dbNum" default:"0"`
	LoginPrefix string `yaml:"loginPrefix" default:"mqenergy_login_auth_"`
}

type Server

type Server struct {
	Mode            string `yaml:"mode" default:"debug"`
	DefaultPageSize int    `yaml:"defaultPageSize" default:"10"`
	MaxPageSize     int    `yaml:"maxPageSize" default:"500"`
	FileUploadPath  string `yaml:"fileUploadPath"`
}

Jump to

Keyboard shortcuts

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