Documentation ¶
Overview ¶
Package config provides a simple way to access configuration values for a service using the Load function.
By default configuration is pulled at build time from CUE files in each service directory ¶
For more information about configuration see https://encore.dev/docs/develop/config.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load[T any]() T
Load returns the fully loaded configuration for this service.
The configuration is loaded from the CUE files in the service directory and will be validated by Encore at compile time, which ensures this function will return a valid configuration at runtime.
Encore will generate a `encore.gen.cue` file in the service directory which will contain generated CUE matching the configuration type T.
Note: This function can only be called from within services and cannot be referenced from other services.
Types ¶
type Value ¶
type Value[T any] func() T
Value represents a value in the configuration for this application which can be any value represented in the configuration files.
It is a function because the underlying value could change while the application is still running due to unit tests providing overrides to test different behaviours. To change the value within a single unit test, use the et.SetCfg function.
type Values ¶
type Values[T any] func() []T
Values represents a list of values in the configuration for this application which can be any value represented in the configuration files.
It is a function because the underlying value could change while the application is still running due to unit tests providing overrides to test different behaviours.