env

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvVar

type EnvVar struct {
	Key     string
	Value   string
	Managed bool // true if managed by lanup
}

EnvVar represents a single environment variable

type EnvWriter

type EnvWriter struct {
	FilePath      string
	BackupEnabled bool
}

EnvWriter handles reading and writing environment files

func NewEnvWriter

func NewEnvWriter(path string) *EnvWriter

NewEnvWriter creates a new EnvWriter instance

func (*EnvWriter) Backup

func (w *EnvWriter) Backup() error

Backup creates a backup of the existing file with .bak extension

func (*EnvWriter) Merge

func (w *EnvWriter) Merge(newVars []EnvVar, existing []EnvVar) []EnvVar

Merge combines new variables with existing ones, preserving non-managed variables

func (*EnvWriter) Read

func (w *EnvWriter) Read() ([]EnvVar, error)

Read parses an existing .env file and returns the variables

func (*EnvWriter) Write

func (w *EnvWriter) Write(vars []EnvVar) error

Write writes the environment variables to the file with proper formatting

Jump to

Keyboard shortcuts

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