config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(env string)

Types

type Config

type Config struct {
	Env  string `mapstructure:"ENV"`
	HTTP `mapstructure:",squash"`
	Log  `mapstructure:",squash"`
	PG   `mapstructure:",squash"`
}
var Global Config

func Load

func Load(env string) (Config, error)

Load reads in configurations from config files and environment variables It uses the following order to override configurations: 1. .default.env, 2. .$env.env, 3. .local.env, 4. environment variables

type Environment

type Environment string
const (
	EnvDev  Environment = "dev"
	EnvProd Environment = "production"
	EnvTest Environment = "test"
)

type HTTP

type HTTP struct {
	Port int `mapstructure:"HTTP_PORT"`
}

type Log

type Log struct {
	Level string `mapstructure:"LOG_LEVEL"`
}

type PG

type PG struct {
	Host     string `mapstructure:"POSTGRES_HOST"`
	Database string `mapstructure:"POSTGRES_DATABASE"`
	User     string `mapstructure:"POSTGRES_USER"`
	Password string `mapstructure:"POSTGRES_PASSWORD"`
	Options  string `mapstructure:"POSTGRES_OPTIONS"`
}

Jump to

Keyboard shortcuts

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