bkeepers/dotenv

A Ruby gem to load environment variables from `.env`.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 29 minutes ago
Added to GitGenius on September 9th, 2026
Created on July 24th, 2012
Open Issues & Pull Requests: 18 (+0)
GitHub issues: Enabled
Number of forks: 515
Total Stargazers: 6,764 (+0)
Total Subscribers: 69 (+0)

Repository Insights (GitGenius)

Most active contributors

Sign in to see contributor activity.

Related repositories by overlapping contributors

No overlapping-contributor repos identified yet.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 9
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 325 days
Stale 30+ days: 9
Stale 90+ days: 8

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

dotenv is a Ruby gem that loads environment variables from a `.env` file into the application's ENV hash during development.

The tool addresses the practical challenge of managing environment-specific configuration without hardcoding secrets or deployment-dependent values into source code. Following twelve-factor app principles, dotenv reads a `.env` file in your project root and populates environment variables that your application can access. This approach avoids the friction of manually setting environment variables on each development machine or CI server, while keeping sensitive data and environment-specific settings out of version control.

Rails applications load dotenv automatically on boot with no additional setup required. For Sinatra or other Ruby applications, you call the load method early in your bootstrap process. The tool supports loading multiple files in priority order, with the first value set for any variable winning out, and existing environment variables are preserved unless you explicitly enable overwriting. A command-line executable lets you prefix application launches with dotenv to ensure variables are loaded before your app starts. The tool also provides an autorestore feature in test environments that automatically resets ENV after each test, preventing state leakage between tests without requiring manual cleanup.

The project maintains steady, focused development activity with regular updates addressing edge cases and test compatibility. Maintenance includes ongoing attention to test infrastructure and ensuring compatibility with evolving Ruby and Rails versions. The tool receives periodic refinements to its core loading logic and configuration handling.