envfile

package
v0.0.0-...-9364404 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Env                map[string]string
	EnableSubstitution bool
}

Config is the configuration for a new envfile parser.

type Parser

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

Parser is capable of parsing environment files. It supports in-line substitution of already defined variables and allows C- and Basic-style comments (//, /*, and #). To support existing env files, Parser supports variables prefixed with "export".

func New

func New(fileName string, r io.Reader) *Parser

New returns a new env-file parser.

func NewWithConfig

func NewWithConfig(fileName string, r io.Reader, cfg Config) *Parser

NewWithConfig returns a new env-file parser with a config.

func (*Parser) Env

func (lex *Parser) Env() map[string]string

Env returns the parsed environment.

func (*Parser) Parse

func (lex *Parser) Parse() error

Jump to

Keyboard shortcuts

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