mirror of
https://github.com/tiennm99/MTTools.git
synced 2026-10-04 05:01:10 +00:00
17 lines
352 B
Go
17 lines
352 B
Go
// Package env loads .env files on init so all cmd/ scripts get env vars automatically.
|
|
// Usage: import _ "github.com/tiennm99/mttools/go-util/internal/env"
|
|
package env
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
func init() {
|
|
// Skip if .env doesn't exist; load if it does.
|
|
if _, err := os.Stat(".env"); err == nil {
|
|
_ = godotenv.Load()
|
|
}
|
|
}
|