config

package
v0.0.0-...-9b7003c Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 5 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 {
	HTTP struct {
		Port int `env:"HTTP_PORT, default=8081"`
	}

	Auth struct {
		JWTSecret string `env:"JWT_SECRET, default=CHANGE_ME"`
	}

	Log struct {
		Level  string `env:"LOG_LEVEL, default=info"`
		Pretty bool   `env:"LOG_PRETTY, default=false"`
	}

	Postgres Postgres `env:", prefix=POSTGRES_"`
	Redis    Redis    `env:", prefix=REDIS_"`
}

func NewConfig

func NewConfig() (Config, error)

type Postgres

type Postgres struct {
	Host        string `env:"HOST, default=localhost"`
	Port        int    `env:"PORT, default=5432"`
	User        string `env:"USER, required"`
	Password    string `env:"PASSWORD, required"`
	Database    string `env:"DB, required"`
	SSLMode     string `env:"SSLMODE, default=verify-full"`
	ConnTimeout int    `env:"CONNTIMEOUT, default=5"`
	MaxConn     int    `env:"MAXCONN, default=8"`
}

type Redis

type Redis struct {
	Host     string `env:"HOST, default=localhost"`
	Port     int    `env:"PORT, default=6379"`
	Username string `env:"USER"`
	Password string `env:"PASSWORD"`
	DB       int    `env:"DB"`
}

Jump to

Keyboard shortcuts

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