interpolation

package
v0.43.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SecretRegex = regexp.MustCompile(`\$\{secrets\.([^}]*)\}`)

SecretRegex matches ${secrets.secret_name} patterns

View Source
var VariableRegex = regexp.MustCompile(`\$\{([a-zA-Z_][a-zA-Z0-9_-]*)\}`)

VariableRegex matches ${variable_name} patterns

Functions

func ToJavaScript

func ToJavaScript(value string) string

ToJavaScript converts a string with variable interpolation to JavaScript code This is used by multihttp to generate JavaScript that references variables

Types

type Resolver

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

Resolver handles string interpolation for both variables and secrets

func NewResolver

func NewResolver(variableProvider VariableProvider, secretProvider SecretProvider, tenantID model.GlobalID, logger zerolog.Logger, secretEnabled bool) *Resolver

NewResolver creates a new interpolation resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, value string) (string, error)

Resolve performs string interpolation, replacing both variables and secrets in a single pass

type SecretProvider

type SecretProvider interface {
	GetSecretValue(ctx context.Context, tenantID model.GlobalID, secretKey string) (string, error)
}

SecretProvider defines the interface for resolving secrets

type VariableProvider

type VariableProvider interface {
	GetVariable(name string) (string, error)
}

VariableProvider defines the interface for resolving variables

Jump to

Keyboard shortcuts

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