injector

package
v0.0.0-...-c3373f0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvAttrName = "env"
	EnvNameKey  = "name"
	EnvTypeKey  = "type"
)
View Source
const (
	EnvTypeString envType = "string"
	EnvTypeInt    envType = "int"
	EnvTypeBool   envType = "bool"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvGetter

type EnvGetter interface {
	Get(key string) (string, bool)
}

EnvGetter is an interface to get environment variables

type Injector

type Injector struct {
	// contains filtered or unexported fields
}

Injector is a struct that injects environment variables into a CUE value

func NewDefaultInjector

func NewDefaultInjector(logger *slog.Logger) Injector

NewDefaultInjector creates a new Injector with default settings and an optional logger.

func NewInjector

func NewInjector(logger *slog.Logger, getter EnvGetter) Injector

NewInjector creates a new Injector

func (*Injector) InjectEnv

func (i *Injector) InjectEnv(v cue.Value, overrides map[string]string) cue.Value

InjectEnv injects environment variables into the given CUE value

type OSEnvGetter

type OSEnvGetter struct{}

OSEnvGetter is an implementation of EnvGetter that gets environment variables from the OS

func (OSEnvGetter) Get

func (OSEnvGetter) Get(key string) (string, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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