config

package
v0.0.0-...-37e7878 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(filename string) (*viper.Viper, error)

LoadConfig Load config file from given path -.

Types

type AppConfig

type AppConfig struct {
	Mode       string `yaml:"mode"`
	LoginLimit int    `yaml:"loginLimit"`
	PassLimit  int    `yaml:"passLimit"`
	IPLimit    int    `yaml:"ipLimit"`
}

type Config

type Config struct {
	App      AppConfig
	Server   ServerConfig
	Logger   LoggerConfig
	Redis    Redis
	Postgres Postgres
}

func GetConfig

func GetConfig(file string) (*Config, error)

GetConfig Get config -.

func ParseConfig

func ParseConfig(v *viper.Viper) (*Config, error)

ParseConfig Parse config file -.

type LoggerConfig

type LoggerConfig struct {
	Development bool   `yaml:"development"`
	Level       string `yaml:"level"`
}

type Postgres

type Postgres struct {
	Dsn     string `yaml:"dsn"`
	PoolMax int    `yaml:"poolMax" env:"PG_POOL_MAX"`
}

type Redis

type Redis struct {
	Host     string `env:"APP_REDIS_HOST"`
	Port     string `env:"APP_REDIS_PORT"`
	Password string `env:"APP_REDIS_PASSWORD"`
}

type ServerConfig

type ServerConfig struct {
	Port              string        `yaml:"port"`
	Mode              string        `yaml:"mode"`
	ReadTimeout       time.Duration `yaml:"readTimeout"`
	WriteTimeout      time.Duration `yaml:"writeTimeout"`
	CtxDefaultTimeout time.Duration `yaml:"ctxDefaultTimeout"`
	Debug             bool          `yaml:"debug"`
}

Jump to

Keyboard shortcuts

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