-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
38 lines (28 loc) · 1.4 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2020, Roel Schut. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package env implements encoding and decoding of environment variables from
files, the OS or other io.Reader compatible data sources. It supports
unmarshalling to structs and maps, and marshaling from various types to files
and io.Writer. It can also be used to load/overload environment variables into
the system.
The mapping between environment variables and Go values is described in the
documentation for the Marshal and Unmarshal functions.
# Supported types
This package uses the rawconv package to parse/unmarshal any string value to
its Go type equivalent. Additionally, custom types may implement the Unmarshaler
interface to implement its own unmarshalling rules, or register an unmarshaler
function using rawconv.Register.
# Load and overload
Additional os.Environ entries can be loaded using the ReadAndLoad, OpenAndLoad,
ReadAndOverload and OpenAndOverload functions. The source is read any bash style
variables are replaced before being set to the system using Setenv.
# Dotenv
The dotenv package supports reading and loading environment variables from .env
files based on active environment (e.g. prod, dev etc.). See its documentation
for more information.
# Writing
This package can also write environment variables to an io.Writer.
*/
package env