joho/godotenv
A Go port of Ruby's dotenv library (Loads environment variables from .env files)
Build with Backblaze B2
SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.
Loading star history...
Where it stands
Rank, growth pace and release cadence relative to everything GStars tracks.
No releases in the last 90 days; the most recent was 168 days ago, with 48 contributors on GitHub.
Use Cases & Benefits
- Loads environment variables from .env files into Go applications to simplify configuration management.
- Enables seamless environment variable loading compatible with twelve-factor app principles, reducing manual setup across environments.
- Use for managing environment-specific configurations in Go projects during local development and testing.
- Use for injecting environment variables in continuous integration pipelines to maintain consistent build environments.
- Use for writing and reading .env files programmatically to automate configuration workflows in Go-based tools.
Should you depend on it?
License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.
License
MIT
Permissive: commercial use, modification and redistribution are allowed with attribution.
Community files
- README: present
Watch-outs
No watch-outs from GStars' checks.
General guidance from repository metadata, not legal advice. How we score
From the README
A Go (golang) port of the Ruby dotenv project (which loads env vars from a .env file).
Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.
But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. Dotenv load variables from a .env file into ENV when the environment is bootstrapped.
It can be used as a library (for loading in env for your own daemons etc.) or as a bin command.
There is test coverage and CI for both linuxish and Windows environments, but I make no guarantees about the bin version working on Windows.
As a library
or if you want to use it as a bin command
Add your application configuration to your
.envfile in the root of your project:Then in your Go app you can do something like
If you're even lazier than that, you can just take advantage of the autoload package which will read in
.envon importWhile
.envin the project root is the default, you don't have to be constrained, both examples below are 100% legitIf you want to be really fancy with your env file you can do comments and exports (below is a valid env file)
Or finally you can do YAML(ish) style
as a final aside, if you don't want godotenv munging your env you can just get a map back instead
Daily snapshots
Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots
Forks
468+9
Open issues
89+8
Compared with peers in Backend
Fastest-growing repositories GStars tracks in this cohort for the week of Nov 8, by 7-day star growth
| Repository | Stars | +7d | Health | Last release |
|---|---|---|---|---|
| anthropics/skills | 192.3K | +5.2K | 75 | — |
| zed-industries/zed | 94.7K | +2.3K | 75 | 6 days ago |
| google/skills | 23.8K | +2.0K | 75 | — |
| NationalSecurityAgency/ghidra | 99.4K | +1.8K | 75 | 19 days ago |
| DuarteSantos8/openGym | 20.8K | +1.7K | 75 | 7 days ago |
| joho/godotenv | 10.7K | — | 45 | 168 days ago |
| Category median | 94.7K | +2.0K | 75 | — |
Discover Repositories
Search across tracked repositories by name or description