env

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package env provides utilities for loading and managing environment variables from containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Variables

type Variables map[string]string

Variables represents a collection of environment variables as a map of string keys to string values.

func Load

func Load(
	ctx context.Context,
	ctr testcontainers.Container,
	filepath string,
) (Variables, error)

Load loads environment variables from a file inside a Docker container.

It reads the file at the specified filepath inside the container, parses its contents, and returns a map of environment variables.

func (Variables) Get

func (v Variables) Get(k string) (string, bool)

Get retrieves the value of the environment variable with the given key.

It returns the value and a boolean indicating whether the variable was found.

func (Variables) MustGet

func (v Variables) MustGet(k string) string

MustGet retrieves the value of the environment variable with the given key and panics if the variable is not found.

func (Variables) Set

func (v Variables) Set(k, value string)

Set sets the value of the environment variable with the given key to the specified value.

Jump to

Keyboard shortcuts

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