envutil

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeKey       = "MODE"
	ModeValueProd = "production"
	ModeValueDev  = "development"
	PortKey       = "PORT"
)

Variables

This section is empty.

Functions

func GetBool

func GetBool(key string, defaultValue bool) bool

func GetInt

func GetInt(key string, defaultValue int) int

func GetStr

func GetStr(key string, defaultValue string) string

func Load

func Load(filenames ...string) (err error)

Convenience wrapper over godotenv.Load

func SetDevMode

func SetDevMode() error

SetDevMode sets the MODE environment variable to "development".

Types

type Base

type Base struct {
	Mode   string
	IsDev  bool
	IsProd bool
	Port   int
}

func InitBase

func InitBase(options InitOptions) (Base, error)

func (*Base) GetIsDev

func (e *Base) GetIsDev() bool

func (*Base) GetPort

func (e *Base) GetPort() int

type Env

type Env interface {
	GetIsDev() bool
	GetPort() int
}

type InitOptions

type InitOptions struct {
	FallbackGetPortFunc func() int
	GetIsDevFunc        func() bool
}

Jump to

Keyboard shortcuts

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