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 ¶
This section is empty.
Variables ¶
View Source
var ( // ConfigEnvPrefix defines the environment variable prefix for reading server configuration from the environment. // This can be overridden to provide a customised default environment prefix for an app. ConfigEnvPrefix = "APP_" // ErrLoadConfig is the sentinel error returned when there was an issue loading the config. ErrLoadConfig = errors.New("error loading config") // ErrInvalidConfig is the sentinel error returned when the config was loaded but contains invalid values. ErrInvalidConfig = errors.New("invalid config") )
Functions ¶
func GetAppName ¶
func GetAppName() string
func GetBaseURL ¶
func GetBaseURL() string
func GetVersion ¶
func GetVersion() string
func IsProduction ¶
func IsProduction() bool
Types ¶
type ContainerRuntime ¶
type ContainerRuntime string
ContainerRuntime identifies the detected container environment.
const ( RuntimeNone ContainerRuntime = "none" RuntimeDocker ContainerRuntime = "docker" RuntimePodman ContainerRuntime = "podman" RuntimeCloudRun ContainerRuntime = "cloudrun" RuntimeUnknown ContainerRuntime = "unknown-container" )
func DetectContainerRuntime ¶
func DetectContainerRuntime() ContainerRuntime
DetectContainerRuntime tries to identify the container runtime we're executing under, checking the most specific/reliable signals first.
type Duration ¶
func NewDuration ¶
func (Duration) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. Serializes Duration to a plain byte slice.
func (*Duration) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. Deserializes a plain byte slice into a Duration.
type Environment ¶
type Environment string
Environment is the app running environment.
const ( // EnvDevelopment represents a development environment. EnvDevelopment Environment = "development" // EnvProduction represents a production environment. EnvProduction Environment = "production" )
func GetEnvironment ¶
func GetEnvironment() Environment
func (Environment) String ¶
func (e Environment) String() string
Click to show internal directories.
Click to hide internal directories.