Documentation
¶
Overview ¶
package "dotenv" provides functionality to consume .env files
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load will read all environment variables from files and writes them to the ENV for this process. (typically using os.Setenv()).
- if `override` is false, Load WILL NOT OVERRIDE the variables that are already set.
- if `files` is empty, Read will default to loading .env in the current working directory.
you can pass multiple files like this :
dotenv.Load(false,"/path/to/file-1","/path/to/file-2")
in this case, Load will read them in the given order, and you can reference keys from other files , just like they were the same file.
file-1:
KEY_1=value
file-2:
KEY_2=$KEY_1
func Read ¶
Read reads all environment variables from the given files and return them as map.
- if `files` is empty, Read will default to loading .env in the current working directory.
you can pass multiple files like this :
dotenv.Read("/path/to/file-1","/path/to/file-2")
in this case, Read will read them in the given order, and you can reference keys from other files , just like they were the same file.
file-1:
KEY_1=value
file-2:
KEY_2=$KEY_1
Types ¶
This section is empty.