package injector

import "github.com/input-output-hk/catalyst-forge/lib/blueprint/pkg/injector"

Index

Constants

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

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)

Source Files

injector.go

Directories

PathSynopsis
pkg/injector/mocks
Version
v0.0.0-20240928203643-c3373f0052b9 (latest)
Published
Sep 28, 2024
Platform
linux/amd64
Imports
6 packages
Last checked
2 days ago

Tools for package owners.