dotenv

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DotEnvPathVar = "ENVCTL_DOTENV_PATH"
)

Functions

This section is empty.

Types

type CleanupFunc

type CleanupFunc func() error

type DotEnvService

type DotEnvService struct {
	// contains filtered or unexported fields
}

func NewDotEnvService

func NewDotEnvService(path string) *DotEnvService

func (*DotEnvService) Create

func (s *DotEnvService) Create(vars models.Vars, args []string) (models.Vars, []string, CleanupFunc, error)

func (*DotEnvService) Marshal

func (s *DotEnvService) Marshal(vars models.Vars) string

Marshal serializes the given vars as a dotenv-formatted string. Each line is in the format: KEY=VALUE where VALUE is determined by the configured quote and escape styles.

func (*DotEnvService) WithEscapeStyle

func (s *DotEnvService) WithEscapeStyle(es EscapeStyle) *DotEnvService

func (*DotEnvService) WithQuoteStyle

func (s *DotEnvService) WithQuoteStyle(qs QuoteStyle) *DotEnvService

func (*DotEnvService) Write

func (s *DotEnvService) Write(vars models.Vars, path string) error

Write serializes the given vars and writes them to path.

type EscapeStyle

type EscapeStyle string

EscapeStyle determines how to escape double-quoted string values.

const (
	// Default escaping behavior.
	EscapeStyleDefault EscapeStyle = "default"
	// Docker Compose escaping behavior.
	EscapeStyleCompose EscapeStyle = "compose"
)

type QuoteStyle

type QuoteStyle string

QuoteStyle determines how to quote dotenv values.

const (
	QuoteStyleNone   QuoteStyle = "none"   // Do not quote values.
	QuoteStyleSingle QuoteStyle = "single" // Single quote values.
	QuoteStyleDouble QuoteStyle = "double" // Double quote values.
)

Jump to

Keyboard shortcuts

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