configs

package
v0.0.0-...-ea7d51e Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectName = "meeseeks"

	RequestHeaderJWTKey = "Authorization"

	RequestHeaderRefershKey = "Authenticate"

	RequestHeaderJWTExpireTime = 60 * 60 * 2

	RequestOpenAPIHeaderAppID     = "Authorization-Appid"
	RequestOpenAPIHeaderSign      = "Authorization-Sign"
	RequestOpenAPIHeaderTimestamp = "Authorization-Timestamp"
	RequestOpenAPIHeaderNone      = "Authorization-None"
)
View Source
const (
	Debug int8 = iota - 1
	Info
	Warn
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server   Server   `mapstructure:"server"`
	RCache   RCache   `mapstructure:"rcache"`
	Database Database `mapstructure:"database"`
	Log      Log      `mapstructure:"log"`
	Jwt      Jwt      `mapstructure:"jwt"`
	WebHook  struct {
		Feishu Feishu `mapstructure:"feishu"`
	} `mapstructure:"webhook"`
	// contains filtered or unexported fields
}

func GetConfig

func GetConfig() *Config

func InitConfig

func InitConfig(configFile string) *Config

func NewConfig

func NewConfig() *Config

NewConfig init config default value

func (*Config) GetDatabase

func (c *Config) GetDatabase() Database

func (*Config) GetLog

func (c *Config) GetLog() Log

func (*Config) GetServer

func (c *Config) GetServer() Server

func (*Config) Watch

func (c *Config) Watch(configurePath string)

type Database

type Database struct {
	// 数据库驱动
	Driver string `mapstructure:"driver"`
	// 数据库连接
	Source string `mapstructure:"source"`
	// 数据库最大空闲连接数
	// 数据库最大打开连接数
	MaxOpenConn int `mapstructure:"max_open_conn"`

	MaxIdleConn int `mapstructure:"max_idle_conn"`

	MaxLifetime int `mapstructure:"max_life_time"`

	Mode int `mapstructure:"mode"`

	Charset string `mapstructure:"charset"`

	LogPath string `mapstructure:"log_path"`
}

type Feishu

type Feishu struct {
	AppId             string `mapstructure:"app_id"`
	AppSecret         string `mapstructure:"secret"`
	EncryptKey        string `mapstructure:"encrypt_key"`
	VerificationToken string `mapstructure:"verification_token"`
}

type Jwt

type Jwt struct {
	Secret         string `mapstructure:"secret"`
	Expire         int64  `mapstructure:"expire"`
	RefreshTimeout int64  `mapstructure:"refresh_timeout"`
	Issuer         string `mapstructure:"issuer"`
	HeaderKey      string `mapstructure:"header_key"`
	RefersKey      string `mapstructure:"refers_key"`
}

type Log

type Log struct {
	// 日志级别
	Level int `mapstructure:"level"`
	// 日志格式
	Format string `mapstructure:"format"`
	// 日志文件
	File string `mapstructure:"file"`
	// 日志文件最大大小
	MaxSize int `mapstructure:"max_size"`
}

type RCache

type RCache struct {
	// driver localhost:6379
	Driver string `mapstructure:"driver"`
	// password auth redis password
	Password string `mapstructure:"password"`
}

type Server

type Server struct {
	// server debug mode (default: true)
	Debug bool `mapstructure:"debug"`
	// server address to listen (default: 0.0.0.0)
	Addr string `mapstructure:"addr"`
	// server port (default: 80)
	Port int `mapstructure:"port"`
	// server max connection (default: 1000)
	MaxConn int `mapstructure:"max_conn"`
	// server read timeout (default: 60)
	ReadTimeout int `mapstructure:"read_timeout"`
	// server log path (default: ./log/server.log)
	LogPath string `mapstructure:"log_path"`
	// server cors config
	CorsAllowOrigins []string `mapstructure:"allow_origins"`
}

Jump to

Keyboard shortcuts

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