config

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDev  = "dev"
	EnvTest = "test"
	EnvPro  = "pro"
)
View Source
const (
	ConfigFileName        = "config_origin.yaml"
	ConfigEncryptFileName = "config.yaml"
)
View Source
const BaseKey = "oSTP7QSjwvzQAtbI"

Variables

View Source
var Container *dig.Container

Functions

This section is empty.

Types

type Config

type Config struct {
	Project  string                   `yaml:"project"`
	Env      string                   `yaml:"env"`
	LogLevel int8                     `yaml:"logLevel"` //全局日志等级
	Gorm     map[string]Gorm          `yaml:"gorm"`
	Redis    map[string]redisd.Config `yaml:"redis"`
	Grpc     map[string]Grpc          `yaml:"grpc"`
	Sms      Sms                      `yaml:"sms"` //短信
	Web      Web                      `yaml:"web"`
}

Config 配置参数

func (*Config) PrintProjectInfo

func (conf *Config) PrintProjectInfo()

type ConfigFile

type ConfigFile struct {
	Secret       string `yaml:"secret"`
	SecretConfig string `yaml:"secretConfig"`
}

type Gorm

type Gorm struct {
	Debug         bool       `yaml:"debug"`
	LogLvl        int        `yaml:"logLvl"`
	SlowThreshold int        `yaml:"slowThreshold"`
	MaxLifetime   int        `yaml:"maxLifeTime"`
	MaxOpenConns  int        `yaml:"maxOpenConns"`
	MaxIdleConns  int        `yaml:"maxIdleConns"`
	Driver        GormDriver `json:"driver"`
	MySQL         MySQL      `yaml:"mysql"`
}

Gorm gorm配置参数

type GormDriver

type GormDriver string
const (
	Mysql GormDriver = "mysql"
)

type Grpc

type Grpc struct {
	Host      string              `yaml:"host"`
	Port      int32               `yaml:"port"`
	WhiteList map[string][]string `yaml:"whiteList"` //白名单
}

func (Grpc) Address

func (g Grpc) Address() string

type MySQL

type MySQL struct {
	Host       string       `yaml:"host"`
	Port       int          `yaml:"port"`
	User       string       `yaml:"user"`
	Password   string       `yaml:"password"`
	DBName     string       `yaml:"dbName"`
	Parameters string       `yaml:"parameters"`
	Variant    MysqlVariant `yaml:"variant"` //mysql变种
}

MySQL mysql配置参数

func (MySQL) DSN

func (a MySQL) DSN() string

DSN 数据库连接串

type MysqlVariant

type MysqlVariant string

type Sms

type Sms struct {
	RegionId  string `yaml:"regionId"`
	AccessKey string `yaml:"accessKey"`
	Secret    string `yaml:"secret"`
}

type Token

type Token struct {
	HeaderName string `yaml:"headerName"`
	HeaderType string `yaml:"headerType"`
	CookieName string `yaml:"cookieName"`
	Key        string `yaml:"key"`
	Alg        string `yaml:"alg"`
	Expire     int64  `yaml:"expire"` //过期时间秒
}

type Web

type Web struct {
	Host   string `yaml:"host"`
	Port   int32  `yaml:"port"`
	Mode   string `yaml:"mode"`
	Prefix string `yaml:"prefix"`
	Token  Token  `yaml:"token"`
}

func (Web) Address

func (g Web) Address() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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