config

package
v0.159.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config provides a global config store that other packages can utilise for fetching/storing configuration. The config store supports both file and environment configuration.

Index

Constants

View Source
const (
	// AppName is the application name.
	AppName = "Foragd"
	// AppID is the application name formatted for use as an ID.
	AppID = "app.foragd"
	// AppDescription is the catch-line of the application.
	AppDescription = "" /* 136-byte string literal not displayed */
	// ConfigEnvPrefix defines the environment variable prefix for reading
	// server configuration from the environment.
	ConfigEnvPrefix = "FORAGD_"
)

Variables

View Source
var (
	ErrLoadConfig    = errors.New("error loading config")
	ErrInvalidConfig = errors.New("invalid config")
)

Functions

func GetBaseURL added in v0.143.0

func GetBaseURL() string

func GetVersion added in v0.143.0

func GetVersion() string

func IsProduction added in v0.143.0

func IsProduction() bool

func Load

func Load[T any](envPrefix string, cfg T) error

Load will load a config via environment variables with the given prefix into an object of the given type.

Types

type Environment

type Environment string

Environment is the app running environment.

const (
	// EnvDevelopment represents a development environment.
	EnvDevelopment Environment = "development"
	// EnvProduction represents a production envrionment.
	EnvProduction Environment = "production"
)

func GetEnvironment added in v0.143.0

func GetEnvironment() Environment

func (Environment) String added in v0.87.0

func (e Environment) String() string

type Timeout added in v0.56.0

type Timeout string

func (Timeout) Duration added in v0.56.0

func (t Timeout) Duration() time.Duration

func (Timeout) Validate added in v0.56.0

func (t Timeout) Validate() error

Jump to

Keyboard shortcuts

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