conf

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConf

type AppConf struct {
	ServerConf *ServerConf  `mapstructure:"app"`
	DataConf   *DataConf    `mapstructure:"data"`
	LogConf    *LogConf     `mapstructure:"log"`
	JwtConf    *JwtConf     `mapstructure:"jwt"`
	LocaleConf *locale.Conf `mapstructure:"locale"`
	EmailConf  *EmailConf   `mapstructure:"email"`
	BuildMeta  BuildInfo
}

AppConf wilson config contains all needed configurations

func NewAppConf

func NewAppConf(config *config.Config, buildInfo BuildInfo) (*AppConf, error)

type BuildInfo

type BuildInfo struct {
	Author    string
	Version   string
	BuildTime string
}

type DataConf

type DataConf struct {
	DatabaseConf *DatabaseConf `mapstructure:"database"`
	RedisConf    *RedisConf    `mapstructure:"redis"`
}

DataConf Here are the data related configurations

type DatabaseConf

type DatabaseConf struct {
	Driver      string        `mapstructure:"driver"`
	Network     string        `mapstructure:"network"`
	Address     string        `mapstructure:"addr"`
	User        string        `mapstructure:"user"`
	Password    string        `mapstructure:"pswd"`
	Params      string        `mapstructure:"params"`
	MaxOpenCons int           `mapstructure:"maxOpenCons"`
	MaxIdleCons int           `mapstructure:"maxIdleCons"`
	MaxIdleTime time.Duration `mapstructure:"maxIdleTime"`
	MaxLifetime time.Duration `mapstructure:"maxLifetime"`
}

DatabaseConf relational database config

type DstConf

type DstConf struct {
	KleiToken string `mapstructure:"kleiToken"`
	SteamKey  string `mapstructure:"steamKey"`
}

type EmailConf

type EmailConf struct {
	Host        string        `mapstructure:"host"`
	Port        int           `mapstructure:"port"`
	User        string        `mapstructure:"user"`
	Password    string        `mapstructure:"password"`
	SendTimeout time.Duration `mapstructure:"timeout"`
	MaxPoolSize int           `mapstructure:"maxPoolSize"`
	Exp         int           `mapstructure:"exp"`
}

func (EmailConf) Address

func (e EmailConf) Address() string

func (EmailConf) Expire

func (e EmailConf) Expire() time.Duration

func (EmailConf) SmtpAuth

func (e EmailConf) SmtpAuth() smtp.Auth

type GrpcConf

type GrpcConf struct {
	Address       string `mapstructure:"address"`
	MaxRecv       int    `mapstructure:"maxRecv"`
	MaxSend       int    `mapstructure:"maxSend"`
	ReadBuffer    int    `mapstructure:"readBuffer"`
	WriteBuffer   int    `mapstructure:"writeBuffer"`
	MaxHeaderSize uint32 `mapstructure:"maxHeaderSize"`
}

type HttpConf

type HttpConf struct {
	Address string `mapstructure:"address"`

	TlsConf  *TlsConf    `mapstructure:"tls"`
	CorsConf *httpx.Cors `mapstructure:"cors"`

	ReadTimeout     time.Duration `mapstructure:"readTimeout"`
	WriteTimeout    time.Duration `mapstructure:"writeTimeout"`
	ReadHeadTimeout time.Duration `mapstructure:"readHeaderTimeout"`
	IdleTimeout     time.Duration `mapstructure:"idleTimeout"`
	MultipartMax    int64         `mapstructure:"multipartMax"`
	MaxHeader       int           `mapstructure:"maxHeader"`
}

HttpConf http server config

type JwtConf

type JwtConf struct {
	Sig   string        `mapstructure:"sig"`
	Isu   string        `mapstructure:"isu"`
	Exp   time.Duration `mapstructure:"exp"`
	RExp  time.Duration `mapstructure:"rexp"`
	Delay time.Duration `mapstructure:"delay"`
}

JwtConf jwt config

type LogConf

type LogConf struct {
	Format     string `mapstructure:"format"`
	Level      string `mapstructure:"level"`
	InfoLog    string `mapstructure:"infoLog"`
	ErrorLog   string `mapstructure:"errorLog"`
	TimeFormat string
	Order      []string
}

LogConf app logger config

type RedisConf

type RedisConf struct {
	Address      string        `mapstructure:"addr"`
	Auth         string        `mapstructure:"auth"`
	Retry        int           `mapstructure:"retry"`
	ReadTimeout  time.Duration `mapstructure:"readTimeout"`
	WriteTimeout time.Duration `mapstructure:"writeTimeout"`
}

RedisConf redis client configuration

func (RedisConf) Options

func (r RedisConf) Options() *redis.Options

type ServerConf

type ServerConf struct {
	Swagger  bool     `mapstructure:"swagger"`
	OpenAPI  bool     `mapstructure:"openapi"`
	HttpConf HttpConf `mapstructure:"http"`
}

ServerConf app config

type TlsConf

type TlsConf struct {
	Enable bool   `mapstructure:"enable"`
	Cert   string `mapstructure:"cert"`
	Pem    string `mapstructure:"pem"`
}

TlsConf tls config

Jump to

Keyboard shortcuts

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