config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckFileReadAllowedFn func(path string) error = func(string) error { return nil }

CheckFileReadAllowedFn checks whether reading a file at the given path is allowed by the active security policy. Defaults to no-op (allow all).

View Source
var FormatParsers = map[string]func([]byte) (interface{}, error){}

FormatParsers contains opt-in parsers for non-core config formats such as YAML. Core supports JSON and .env without third-party dependencies.

View Source
var ObjectToNativeFn func(obj object.Object) interface{}

ObjectToNativeFn converts an object.Object back to a Go native value. Must be set by the host package.

View Source
var ParseJSONToObjectFn func(raw string) (object.Object, error)

ParseJSONToObjectFn converts a JSON string to an object.Object. Must be set by the host package.

View Source
var SanitizePathFn func(userPath string) (string, error) = func(p string) (string, error) {
	return filepath.Abs(p)
}

SanitizePathFn validates/resolves user-supplied paths. The host package must set this before calling LoadConfigObjectFromPath.

View Source
var ToObjectFn func(v interface{}) object.Object

ToObjectFn converts an arbitrary Go value to an object.Object. Must be set by the host package.

Functions

func ApplySecretWrapping

func ApplySecretWrapping(obj object.Object) object.Object

func DetectConfigFormat

func DetectConfigFormat(path, explicit string) string

func IsSensitiveKey

func IsSensitiveKey(key string) bool

func LoadConfigObjectFromPath

func LoadConfigObjectFromPath(path, format string) (object.Object, error)

LoadConfigObjectFromPath reads a config file and returns an object.Object with sensitive values wrapped as Secrets.

func LoadConfigObjectFromRaw

func LoadConfigObjectFromRaw(raw, format string) (object.Object, error)

LoadConfigObjectFromRaw parses raw config content (not from a file).

func ObjectToJSONWithSecrets

func ObjectToJSONWithSecrets(obj object.Object) (string, error)

ObjectToJSONWithSecrets marshals an object to JSON, exposing secret values.

func ParseDotEnv

func ParseDotEnv(data []byte) (map[string]string, error)

func RegisterFormatParser

func RegisterFormatParser(format string, parser func([]byte) (interface{}, error))

RegisterFormatParser registers a config parser for a detected format.

func SecretValue

func SecretValue(obj object.Object) (string, bool)

SecretValue extracts the raw string value from a Secret (or wrapped Secret).

Types

This section is empty.

Jump to

Keyboard shortcuts

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