env

package
v1.35.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEnv

func ParseEnv(envFilePath, key string) (string, error)

ParseEnv implements a strict parser for environment files using a subset of POSIX shell syntax. The parser enforces that all variable values must be enclosed in single quotes.

Supported format:

  • VAR='value' - Values must be enclosed in single quotes
  • Content within single quotes is preserved literally (no escape sequences or expansions)
  • Multi-line values are supported (newlines within single quotes are preserved)
  • Inline comments after the closing quote are supported (e.g., VAR='value' # comment)
  • Leading whitespace before the variable name is ignored
  • Blank lines (including those with only whitespace) are ignored when not within quotes
  • Lines starting with '#' are treated as comments and ignored
  • Whitespace before '=' is invalid (e.g., VAR = 'value' is rejected)
  • Whitespace after '=' but before the quote results in empty assignment (e.g., VAR= 'value' assigns empty string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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