config

package
v0.0.0-...-824ed62 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLogLvl = "DEBUG"
	InfoLogLvl  = "INFO"
	ErrorLogLvl = "ERROR"
)

Allowed logger levels & config key.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Salt            string        `env:"APP_SALT,notEmpty"`
	SigningKey      string        `env:"SIGNING_KEY,notEmpty"`
	AccessTokenTTL  time.Duration `env:"ACCESS_TOKEN_TTL" envDefault:"15m"`
	RefreshTokenTTL time.Duration `env:"REFRESH_TOKEN_TTL" envDefault:"24h"`
}

type Config

type Config struct {
	Server   Server
	DB       Postgres
	Auth     AuthConfig
	SMTP     SMTP
	LogLevel string `env:"LOG_LEVEL" envDefault:"INFO"`
}

func InitConfig

func InitConfig() (Config, error)

type Postgres

type Postgres struct {
	Host     string `env:"DB_HOST,notEmpty"`
	Port     string `env:"DB_PORT" envDefault:"5432"`
	Database string `env:"DB_NAME,notEmpty"`
	User     string `env:"DB_USER,notEmpty"`
	Password string `env:"DB_PASSWORD,notEmpty"`
	SSLmode  string `env:"DB_SSL_MODE" envDefault:"disable"`
}

type SMTP

type SMTP struct {
	MailAccount       string `env:"SMTP_ACCOUNT"`
	AccountPassword   string `env:"SMTP_PASSWORD"`
	SMTPServerAddress string `env:"SMTP_ADDRESS"`
	SMTPPort          string `env:"SMTP_PORT"`
	CaptchaKey        string `env:"CAPTCHA_KEY"`
}

type Server

type Server struct {
	AppAddress      string        `env:"APP_PORT" envDefault:"7000"`
	AppReadTimeout  time.Duration `env:"APP_READ_TIMEOUT" envDefault:"60s"`
	AppWriteTimeout time.Duration `env:"APP_WRITE_TIMEOUT" envDefault:"60s"`
	AppIdleTimeout  time.Duration `env:"APP_IDLE_TIMEOUT" envDefault:"60s"`
}

Jump to

Keyboard shortcuts

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