env

package
v0.0.0-...-707188c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Development env definition.
	Development string = "development"
	// Staging env definition.
	Staging = "staging"
	// Production env definition.
	Production = "production"
)

Variables

This section is empty.

Functions

func AppEnvironment

func AppEnvironment() string

AppEnvironment returns the app environment.

func Get

func Get(key, fallback string) string

Get provides a default override for environment vars as a second argument.

func GetOrError

func GetOrError(key string) (string, error)

GetOrError will attempt to get the value from the environment variable and return an error if not available.

func IsDevelopment

func IsDevelopment() bool

IsDevelopment returns whether we are running the app in development.

func IsProduction

func IsProduction() bool

IsProduction returns whether we are running the app in production.

func IsStaging

func IsStaging() bool

IsStaging returns whether we are running the app in staging.

func ParseConfig

func ParseConfig(cfg any, filenames ...string) error

ParseConfig loads the environment variables from the .env file and parses the environment variables into the provided struct. It returns an error if the .env file cannot be loaded or if the environment variables cannot be parsed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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