env

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package env validates environment variables against a schema and example file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Errors []ValidationError
}

Result holds the outcome of env validation.

func Validate

func Validate(envFile, exampleFile string, schema map[string]config.EnvVar) Result

Validate checks env vars against an example file and schema.

func ValidateWithDefaults

func ValidateWithDefaults(envFile, exampleFile string, schema map[string]config.EnvVar) (Result, map[string]string)

ValidateWithDefaults validates env vars and injects schema defaults for missing keys. It returns the validation result and a map of keys that were filled with defaults.

func (Result) Valid

func (r Result) Valid() bool

Valid returns true if no validation errors were found.

type ValidationError

type ValidationError struct {
	Key     string
	Message string
}

ValidationError represents a single env variable validation failure.

func (ValidationError) Error

func (e ValidationError) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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