dotenv

package
v2.34.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 4 Imported by: 2

README

go-dotenv

Go parsing library for the dotenv format.

There is no formal definition of the dotenv format but it has been introduced by https://github.com/bkeepers/dotenv which is thus canonical. This library is a port of that.

This library was developed specifically for direnv.

Features

  • k=v format
  • bash export k=v format
  • yaml k: v format
  • variable expansion, including default values as in ${FOO:-default}
  • comments

Missing

  • probably needs API breakage

Alternatives

Some other good alternatives with various variations.

Documentation

Overview

Package dotenv implements the parsing of the .env format.

There is no formal definition of the format but it has been introduced by https://github.com/bkeepers/dotenv which is thus canonical.

Index

Constants

View Source
const LINE = `` /* 419-byte string literal not displayed */

LINE is the regexp matching a single line

Variables

This section is empty.

Functions

func MustParse

func MustParse(data string) map[string]string

MustParse works the same as Parse but panics on error

func Parse

func Parse(data string) (map[string]string, error)

Parse reads a string in the .env format and returns a map of the extracted key=values.

Ported from https://github.com/bkeepers/dotenv/blob/84f33f48107c492c3a99bd41c1059e7b4c1bb67a/lib/dotenv/parser.rb

Types

This section is empty.

Jump to

Keyboard shortcuts

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