config

package
v0.0.0-...-3b8996f Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Rdb *redis.Client
	Ctx = context.Background()
)

Functions

func InitLogger

func InitLogger(c Conf) *zap.SugaredLogger

func InitRedis

func InitRedis(c Conf) error

Types

type Conf

type Conf struct {
	App           SectionApp           `ini:"app"`
	Zap           SectionZap           `ini:"zap"`
	Gin           SectionGin           `ini:"gin"`
	Core          SectionCore          `ini:"core"`
	Log           SectionLog           `ini:"log"`
	Redis         SectionRedis         `ini:"redis"`
	DingTalk      SectionDingTalk      `int:"ding_talk"`
	ConsumerQueue SectionConsumerQueue `ini:"consumer_queue"`
}

func LoadConfig

func LoadConfig(confPath string) (Conf, error)

type SectionApp

type SectionApp struct {
	Name  string `ini:"name"`
	Debug bool   `ini:"debug"`
}

type SectionConsumerQueue

type SectionConsumerQueue struct {
	Host      string `ini:"host"`
	Port      string `ini:"port"`
	Password  string `ini:"password"`
	QueueName string `ini:"queue_name"`
}

type SectionCore

type SectionCore struct {
	BucketSize        int    `ini:"bucket_size"`
	BucketName        string `ini:"bucket_name"`
	QueueName         string `ini:"queue_name"`
	QueueBlockTimeout int64  `ini:"queue_block_timeout"`
}

type SectionDingTalk

type SectionDingTalk struct {
	SwitchOn    bool   `ini:"switch_on"`
	BaseUrl     string `ini:"base_url"`
	AccessToken string `ini:"access_token"`
}

type SectionGin

type SectionGin struct {
	Mode    string `ini:"mode"`
	Address string `ini:"address"`
	Port    string `ini:"port"`
}

type SectionLog

type SectionLog struct {
	Format      string `ini:"format"`
	AccessLog   string `ini:"access_log"`
	AccessLevel string `ini:"access_level"`
	ErrorLog    string `ini:"error_log"`
	ErrorLevel  string `ini:"error_level"`
}

type SectionRedis

type SectionRedis struct {
	Host         string        `ini:"host"`
	Port         string        `ini:"port"`
	Password     string        `ini:"password"`
	DB           int           `ini:"db"`
	DialTimeout  time.Duration `ini:"dial_timeout"`
	ReadTimeout  time.Duration `ini:"read_timeout"`
	WriteTimeout time.Duration `ini:"write_timeout"`
}

type SectionZap

type SectionZap struct {
	Dir        string `ini:"dir"`
	MaxSize    int    `ini:"max_size"`
	MaxBackups int    `ini:"max_backups"`
	MaxAge     int    `ini:"max_age"`
	Compress   bool   `ini:"compress"`
}

Jump to

Keyboard shortcuts

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