config

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

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 2 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 {
	LogLevel string      `yaml:"log_level" env:"LOG_LEVEL"` // trace, debug, info, warn, error, fatal, panic, disabled
	Host     string      `yaml:"host" env:"HOST"`
	HTTP     HTTPConfig  `yaml:"http"`
	Mongo    MongoConfig `yaml:"mongo"`
	Redis    RedisConfig `yaml:"redis"`
}

func LoadConfig

func LoadConfig(configFilePath string) (Config, error)

type HTTPConfig

type HTTPConfig struct {
	Port             int    `yaml:"port" env:"HTTP_PORT"`
	AuthTokenExpTime int    `yaml:"auth_token_exp_time" env:"AUTH_TOKEN_EXP_TIME"`
	AuthSecret       string `yaml:"auth_secret" env:"AUTH_SECRET"`
}

type MongoConfig

type MongoConfig struct {
	Host     string `yaml:"host" env:"MONGO_HOST"`
	Port     int    `yaml:"port" env:"MONGO_PORT"`
	User     string `yaml:"user" env:"MONGO_USER"`
	Password string `yaml:"password" env:"MONGO_PASSWORD"`
	Database string `yaml:"database" env:"MONGO_DATABASE"`
}

type RedisConfig

type RedisConfig struct {
	Host     string `yaml:"host" env:"REDIS_HOST"`
	Port     int    `yaml:"port" env:"REDIS_PORT"`
	Password string `yaml:"password" env:"REDIS_PASSWORD"`
	Database int    `yaml:"database" env:"REDIS_DATABASE"`
}

Jump to

Keyboard shortcuts

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