configs

package
v0.0.0-...-585f28f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mysql  MysqlConfig
	System SystemConfig
	Log    LogConfig
	Mgo    Mongodb
	JWT    JWTConfig
)

Functions

func InitConfig

func InitConfig(configPath string) (err error)

Types

type Config

type Config struct {
	Mysql   MysqlConfig  `mapstructure:"mysql"`
	System  SystemConfig `mapstructure:"system"`
	Log     LogConfig    `mapstructure:"log"`
	Mongodb Mongodb      `mapstructure:"mongodb"`
	Redis   RedisConfig  `mapstructure:"redis"`
	JWT     JWTConfig    `mapstructure:"jwt"`
}

func NewCfg

func NewCfg(p string) Config

type Environment

type Environment string
const (
	ENVIRONMENT Environment = "RUN_ENVIRONMENT"
)

type EnvironmentType

type EnvironmentType int
const (
	Dev EnvironmentType = iota
	Docker
	Test
)

func RunEnvironment

func RunEnvironment() EnvironmentType

type JWTConfig

type JWTConfig struct {
	Secret string `mapstructure:"secret"`
	Expire int    `mapstructure:"expire"`
}

type Level

type Level int8
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel Level = iota + 1
	// ProsecutionLevel InfoLevel is the default logging priority.
	ProsecutionLevel
)

type LogConfig

type LogConfig struct {
	Path       string `mapstructure:"path"`
	Level      int    `mapstructure:"level"`
	MaxSize    int    `mapstructure:"max_size"`
	MaxBackups int    `mapstructure:"max_backups"`
	MaxAge     int    `mapstructure:"max_age"`
}

type Mongodb

type Mongodb struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
	DataBase string `mapstructure:"database"`
}

type MysqlConfig

type MysqlConfig struct {
	DockerHost   string `mapstructure:"docker_host"`
	Host         string `mapstructure:"host"`
	Port         string `mapstructure:"port"`
	User         string `mapstructure:"user"`
	Password     string `mapstructure:"password"`
	MaxOpenConns int    `mapstructure:"max_open_conns"`
	MaxIdleConns int    `mapstructure:"max_idle_conns"`
	Database     string `mapstructure:"database"`
}

type RedisConfig

type RedisConfig struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	Password string `mapstructure:"password"`
	Database int    `mapstructure:"database"`
}

type SystemConfig

type SystemConfig struct {
	Port  string `mapstructure:"port"`
	Level Level  `mapstructure:"level"`
}

Jump to

Keyboard shortcuts

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