🌚 easyenv
Environment variables in Golang never have been simpler!
Save them in the file and you are ready to Go!
No more need to set your variables in Shell!
Usage
-
Import my package to your project
go get github.com/adamjedrzejec/easyenv
-
Then inside your .go file import easyenv package:
import "github.com/adamjedrzejec/easyenv"
-
Create file with any name you wish to store your environment variables, e.g.
.env
. Do not forget to add it to.gitignore
-
Store your environment variables line-by-line. Working formats:
KEY=VALUE
KEY VALUE
KEY = VALUE
-
Inside the file you have imported easyenv package, you can use the
easyenv.GetEnv(<absolute_path_to_env_file>)
function, to get your environment variables. It returns two values:map[string]string
anderror
.