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 = "foragd-app" // AppDescription is the catch-line of the application. AppDescription = "" /* 214-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") )
View Source
var Init = sync.OnceValue(func() error { if Version == "_UNKNOWN_" { return fmt.Errorf("%w: version not set correctly", ErrLoadConfig) } CurrentEnvironment = Environment(os.Getenv("FORAGD_ENVIRONMENT")) return nil })
Init ensures the application will have appropriate Version and Envrionment vars set.
View Source
var Version = "_UNKNOWN_"
Version is the application/stack version.
Functions ¶
Types ¶
type Environment ¶
type Environment string
const ( EnvDevelopment Environment = "development" EnvProduction Environment = "production" )
var CurrentEnvironment Environment
CurrentEnvironment is the environment in which the app is running (i.e., production, development).
Click to show internal directories.
Click to hide internal directories.