config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version           string                  `yaml:"version"`
	ServerConfig      ServerConfigStruct      `yaml:"server"`
	LoggerConfig      LoggerConfigStruct      `yaml:"logger"`
	DBConfig          DBConfigStruct          `yaml:"db"`
	RedisConfig       RedisConfigStruct       `yaml:"redis"`
	UserServiceConfig UserServiceConfigStruct `yaml:"user_service"`
	RabbitMQConfig    RabbitMQConfigStruct    `yaml:"rabbitmq"`
	OssConfig         OssConfigStruct         `yaml:"oss"`
}

func GetConfig

func GetConfig() *Config

GetConfig 获取配置

func (*Config) Init

func (cfg *Config) Init(configFilePath string)

Init 初始化配置

type DBConfigStruct added in v0.1.3

type DBConfigStruct struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	DbName   string `yaml:"database"`

	MaxIdleConns int `yaml:"max_idle_conns"`
	MaxOpenConns int `yaml:"max_open_conns"`

	ConnMaxLifetime int `yaml:"conn_max_lifetime"`
}

type LoggerConfigStruct

type LoggerConfigStruct struct {
	Level string `yaml:"level"`
	Path  string `yaml:"path"`
}

LoggerConfigStruct logger配置

type OssConfigStruct added in v0.1.20

type OssConfigStruct struct {
	Endpoint        string `yaml:"endpoint"`
	AccessKeyID     string `yaml:"access_key_id"`
	AccessKeySecret string `yaml:"access_key_secret"`
	BucketName      string `yaml:"bucket_name"`
}

type RSAConfigStruct added in v0.1.3

type RSAConfigStruct struct {
	PrivateKeyPath string `yaml:"private_key"`
	PublicKeyPath  string `yaml:"public_key"`
}

type RabbitMQConfigStruct added in v0.1.20

type RabbitMQConfigStruct struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type RedisConfigStruct added in v0.1.13

type RedisConfigStruct struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`

	MaxIdle     int `yaml:"max_idle"`
	MaxActive   int `yaml:"max_active"`
	IdleTimeout int `yaml:"idle_timeout"`
}

type ServerConfigStruct

type ServerConfigStruct struct {
	Port int `yaml:"port"`
}

ServerConfigStruct server配置

type UserServiceConfigStruct added in v0.1.16

type UserServiceConfigStruct struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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