config

package
v0.0.0-...-a54da22 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Host        string `mapstructure:"APP_HOST"`
	Port        int    `mapstructure:"APP_PORT"`
	JWTSecret   string `mapstructure:"JWT_SECRET"`
	ApiEndpoint string `mapstructure:"API_ENDPOINT"`
}

type AppConfigs

type AppConfigs struct {
	*viper.Viper
}

func (*AppConfigs) GetAppConfig

func (c *AppConfigs) GetAppConfig() AppConfig

func (*AppConfigs) GetDatabaseConfig

func (c *AppConfigs) GetDatabaseConfig() DatabaseConfig

func (*AppConfigs) GetRedisConfig

func (c *AppConfigs) GetRedisConfig() RedisConfig

type DatabaseConfig

type DatabaseConfig struct {
	Driver   string `mapstructure:"DB_DRIVER"`
	Name     string `mapstructure:"DB_NAME"`
	Address  string `mapstructure:"DB_ADDRESS"`
	Port     int    `mapstructure:"DB_PORT"`
	Username string `mapstructure:"DB_USERNAME"`
	Password string `mapstructure:"DB_PASSWORD"`
}

type Provider

type Provider interface {
	ConfigFileUsed() string
	Get(key string) interface{}
	GetBool(key string) bool
	GetDuration(key string) time.Duration
	GetFloat64(key string) float64
	GetInt(key string) int
	GetInt64(key string) int64
	GetSizeInBytes(key string) uint
	GetString(key string) string
	GetStringMap(key string) map[string]interface{}
	GetStringMapString(key string) map[string]string
	GetStringMapStringSlice(key string) map[string][]string
	GetStringSlice(key string) []string
	GetTime(key string) time.Time
	InConfig(key string) bool
	IsSet(key string) bool
	GetDatabaseConfig() DatabaseConfig
	GetAppConfig() AppConfig
	GetRedisConfig() RedisConfig
}

Provider the config provider

func Config

func Config() Provider

Config return provider so that you can read config anywhere

type RedisConfig

type RedisConfig struct {
	Address  string `mapstructure:"REDIS_ADDRESS"`
	Port     int    `mapstructure:"REDIS_PORT"`
	Password string `mapstructure:"REDIS_PASSWORD"`
}

Jump to

Keyboard shortcuts

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