envconfig

package
v0.0.0-...-d6791e1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatabaseEnvConfig = DatabaseEnv{}
View Source
var JwtEnvConfig = JwtEnv{}
View Source
var RedisEnvConfig = RedisEnv{}
View Source
var ServerEnvConfig = ServerEnv{} // empty struct

ServerEnvConfig global env variables

View Source
var TelegramEnvConfig = TelegramEnv{}

Functions

This section is empty.

Types

type DatabaseEnv

type DatabaseEnv struct {
	DatabaseHost     string `env:"DATABASE_HOST,required"`
	DatabasePort     int    `env:"DATABASE_PORT,required"`
	DatabaseUser     string `env:"DATABASE_USER,required"`
	DatabasePassword string `env:"DATABASE_PASSWORD,required"`
	DatabaseName     string `env:"DATABASE_NAME,required"`
	DatabaseSslMode  string `env:"DATABASE_SSL_MODE,required"`

	DatabaseMaxConnections         int           `env:"DATABASE_MAX_CONNECTIONS,required" envDefault:"50"`
	DatabaseMaxIdleConnections     int           `env:"DATABASE_MAX_IDLE_CONNECTIONS,required" envDefault:"10"`
	DatabaseMaxLifetimeConnections time.Duration `env:"DATABASE_MAX_LIFETIME_CONNECTIONS,required" envDefault:"5m"`
}

type JwtEnv

type JwtEnv struct {
	JwtAccessTokenSecretKey       string        `env:"JWT_ACCESS_TOKEN_SECRET_KEY,required"`
	JwtRefreshTokenSecretKey      string        `env:"JWT_REFRESH_TOKEN_SECRET_KEY,required"`
	JwtAccessTokenExpire          time.Duration `env:"JWT_ACCESS_TOKEN_EXPIRE,required"`
	JwtRefreshTokenExpire         time.Duration `env:"JWT_REFRESH_TOKEN_EXPIRE" envDefault:"7d"`
	JwtRefreshTokenExpireRemember time.Duration `env:"JWT_REFRESH_TOKEN_EXPIRE_REMEMBER" envDefault:"60d"`
}

type RedisEnv

type RedisEnv struct {
	RedisHost     string `env:"REDIS_HOST,required" envDefault:"localhost"`
	RedisPort     int    `env:"REDIS_PORT,required" envDefault:"6379"`
	RedisUsername string `env:"REDIS_USERNAME,required" envDefault:""`
	RedisPassword string `env:"REDIS_PASSWORD,required" envDefault:""`
	RedisDb       int    `env:"REDIS_DB,required" envDefault:"0"`
}

type ServerEnv

type ServerEnv struct {
	ServerEnv         string `env:"SERVER_ENV,required" envDefault:"development"`
	ServerUrl         string `env:"SERVER_URL,required"`
	ServerReadTimeout int    `env:"SERVER_READ_TIMEOUT" envDefault:"30"`

	ServerCorsAllowOrigins string `env:"CORS_ALLOW_ORIGINS,required" envDefault:"*"`
}

ServerEnv struct for environment variables

type TelegramEnv

type TelegramEnv struct {
	TelegramBotToken   string `env:"TELEGRAM_BOT_TOKEN,required"`
	TelegramBotTimeout int    `env:"TELEGRAM_BOT_TIMEOUT,required" envDefault:"30"`
	TelegramBotDebug   bool   `env:"TELEGRAM_BOT_DEBUG,required" envDefault:"false"`
	TelegramBotChatId  int64  `env:"TELEGRAM_BOT_CHAT_ID,required"`
}

Jump to

Keyboard shortcuts

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