https://github.com/etkecc/go-env
https://github.com/etkecc/go-env
environment library
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/etkecc/go-env
- Owner: etkecc
- License: lgpl-3.0
- Created: 2024-08-08T18:18:59.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-12-12T08:27:52.000Z (7 months ago)
- Last Synced: 2025-01-23T13:13:59.730Z (5 months ago)
- Topics: environment, library
- Language: Go
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ENV
Simple go environment variables reader, for env-based configs
Automatically loads .env file if exists
```go
env.SetPrefix("app") // all env vars should start with APP_
login := env.String("matrix.login", "none") // export APP_MATRIX_LOGIN=buscarron
enabled := env.Bool("form.enabled") // export APP_FORM_ENABLED=1
size := env.Int("cache.size", 1000) // export APP_CACHE_SIZE=500
slice := env.Slice("form.fields") // export APP_FORM_FIELDS="one two three"// need to load custom env file?
dotenv.Load(".env.dev", ".env.local")
```see more in godoc