Env
This is a minimalistic library for accessing environment variables in Go.
Features
- Simple methods for creating and retrieving environment variables
- Allows a fallback value if an environment variable is not set
Usage
package main
import (
"github.com/rrandall91/env"
)
func main() {
// Create a new environment variable
env.Set("MY_ENV_VAR", "my value")
// Get the value of an environment variable or a fallback value if it is not set
env.Get("MY_ENV_VAR", "fallback value")
// Get the value of an environment variable with a fallback
env.GetWithDefault("MY_ENV_VAR", "default value")
}
License
Copyright (c) 2022-present Rashaad Randall. Env is free and open-source software licensed under the GNU Affero General Public License.