config

package
v0.0.0-...-55babe7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 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 {
	Version    string   `env:"VERSION" envDefault:"UNDEFINED"`
	HashSecret string   `env:"HASH_SECRET,required"`
	HTTPPort   int      `env:"HTTP_PORT" envDefault:"8000"`
	Database   Database `envPrefix:"DB_"`
	Redis      Redis    `envPrefix:"REDIS_"`
}

func New

func New(lc fx.Lifecycle) *Config

New builds a configuration struct that will be used by the application. It will be available to all of the application's dependencies.

type Database

type Database struct {
	User     string `env:"USER" envDefault:"postgres"`
	Password string `env:"PASSWORD"`
	Name     string `env:"NAME" envDefault:"fedits"`
	Host     string `env:"HOST" envDefault:"localhost"`
	Port     int    `env:"PORT" envDefault:"5432"`
	SSLMode  string `env:"SSL_MODE"`
	TimeZone string `env:"TIME_ZONE" envDefault:"America/Sao_Paulo"`
}

type Redis

type Redis struct {
	Addr     string `env:"ADDR" envDefault:"localhost:6379"`
	Username string `env:"USERNAME"`
	Password string `env:"PASSWORD"`
	DB       int    `env:"DB" envDefault:"0"`
}

Jump to

Keyboard shortcuts

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