config

package
v0.0.0-...-8ab8685 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(folder, file string) error

Types

type AppConfig

type AppConfig struct {
	BaseURL string `mapstructure:"baseUrl"`
}

type Config

type Config struct {
	App      AppConfig     `mapstructure:"app"`
	HTTP     HTTPConfig    `mapstructure:"http"`
	Limiter  LimiterConfig `mapstructure:"ttl"`
	CacheTTL time.Duration `mapstructure:"ttl"`
	Postgres PostgresConfig
	Redis    RedisConfig
}

func Get

func Get() *Config

type HTTPConfig

type HTTPConfig struct {
	Host               string        `mapstructure:"host"`
	Port               string        `mapstructure:"port"`
	ReadTimeout        time.Duration `mapstructure:"readTimeout"`
	WriteTimeout       time.Duration `mapstructure:"writeTimeout"`
	MaxHeaderMegabytes int           `mapstructure:"maxHeaderMegabytes"`
}

type LimiterConfig

type LimiterConfig struct {
	RPS   int
	Burst int
	TTL   time.Duration
}

type PostgresConfig

type PostgresConfig struct {
	Port     string `mapstructure:"port"`
	Host     string `mapstructure:"host"`
	Name     string `mapstructure:"dbName"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

func (PostgresConfig) GetDSN

func (pc PostgresConfig) GetDSN() string

func (PostgresConfig) GetMaxIdleConn

func (pc PostgresConfig) GetMaxIdleConn() int

func (PostgresConfig) GetMaxOpenConn

func (pc PostgresConfig) GetMaxOpenConn() int

type RedisConfig

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

func (RedisConfig) GetAddr

func (rc RedisConfig) GetAddr() string

func (RedisConfig) GetDB

func (rc RedisConfig) GetDB() int

func (RedisConfig) GetPassword

func (rc RedisConfig) GetPassword() string

Jump to

Keyboard shortcuts

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