config

package
v1.34.3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

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 Bool

type Bool = Value[bool]

type Bytes

type Bytes = Value[[]byte]

type Float32

type Float32 = Value[float32]

type Float64

type Float64 = Value[float64]

type Int

type Int = Value[int]

type Int16

type Int16 = Value[int16]

type Int32

type Int32 = Value[int32]

type Int64

type Int64 = Value[int64]

type Int8

type Int8 = Value[int8]

type String

type String = Value[string]

type Time

type Time = Value[time.Time]

type UUID

type UUID = Value[uuid.UUID]

type Uint

type Uint = Value[uint]

type Uint16

type Uint16 = Value[uint16]

type Uint32

type Uint32 = Value[uint32]

type Uint64

type Uint64 = Value[uint64]

type Uint8

type Uint8 = Value[uint8]

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.

Jump to

Keyboard shortcuts

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