env

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

README

env

Package env can be used to load environment variables from files.

import (
	"code.soquee.net/env"
)

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the LICENSE file.

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Documentation

Overview

Package env can be used to load environment variables from files.

The following is a complete example of a file that can be parsed by this package:

# Lines beginning with "#" are comments and are skipped.

# Comments are not supported at the end of lines, this
# will result in a variable "Foo" with the value "Bar #Baz"
Foo=Bar #Baz

# Whitespace is trimmed with strings.TrimSpace. To include
# spaces, wrap the value in "double quotes", or `back ticks`.
# The following results in "Foo" having the value "Bar ".
Foo = "Bar "

# Finally, single characters may be quoted with single quotes.
# If single quotes are used on something that is not a single
# character they are not unwrapped and are part of the string.
# The following results in "Foo" having the value "'Bar'" and
# "Bar" having the value "b".
Foo='Bar'
Bar='b'

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(fd io.Reader) error

Read loads a list of environment variables from a reader and puts them into the processes local environment.

func ReadFS added in v0.0.2

func ReadFS(vfs fs.FS, fpath string) error

ReadFS is like Read except that it opens and reads from a file in a filesystem.

func ReadFile added in v0.0.2

func ReadFile(fpath string) error

ReadFile is like Read except that it opens and reads from a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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