Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ermos/dotenv
Go package for working with env file easily
https://github.com/ermos/dotenv
dotenv dotenv-parser go go-package golang
Last synced: 19 days ago
JSON representation
Go package for working with env file easily
- Host: GitHub
- URL: https://github.com/ermos/dotenv
- Owner: ermos
- License: mit
- Created: 2020-11-29T13:22:34.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-02T09:56:26.000Z (9 months ago)
- Last Synced: 2024-05-02T22:31:15.686Z (9 months ago)
- Topics: dotenv, dotenv-parser, go, go-package, golang
- Language: Go
- Homepage: https://github.com/ermos/dotenv
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DotEnv ♻️
> Loads environment variables from .env file with Go## Installation
```bash
go get github.com/ermos/dotenv
```## Usage
This package contains only one method : ``dotenv.Parse()``,
It allows to load a list of environment variable from an `.env` file.## Example
#### .env
```.env
toto=tata
lib_desc=Loads environment variables from .env file with Go
```#### main.go
```go
import (
"fmt"
"github.com/ermos/dotenv"
"os"
)func main () {
// Load environment variables
if err := dotenv.Parse(".env"); err != nil {
log.Fatal(err)
}
fmt.Println(os.Getenv("lib_desc"))
fmt.Printf("Toto is equal to %s", os.Getenv("toto"))
}
```#### Result
```bash
> Loads environment variables from .env file with Go
> Toto is equal to tata
```