config

package
v0.0.0-...-c4b14b8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

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       Mongo
	Auth     AuthConfig
	LogLevel string `env:"LOG_LEVEL" envDefault:"INFO"`
}

func InitConfig

func InitConfig() (Config, error)

type Mongo

type Mongo struct {
	ConnectionString string `env:"MONGO_CONNECTION_STRING" envDefault:"mongodb://localhost:27017"`
	NameDB           string `env:"MONGO_DB" envDefault:"movie-recommender"`
	Username         string `env:"MONGO_USERNAME" envDefault:"root"`
	Password         string `env:"MONGO_PASSWORD" envDefault:"example"`
}

type Server

type Server struct {
	AppAddress      string        `env:"APP_PORT" envDefault:"8000"`
	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