A Go library that loads environment variables from .env files, following the twelve-factor app methodology.
GoDotEnv is a Go library that loads environment variables from `.env` files into your application's environment. It solves the problem of managing configuration across different deployment environments, such as development, testing, and production, by extracting sensitive data like database credentials and API keys from code. This follows the twelve-factor app methodology, ensuring configuration remains separate from code.
Go developers building applications that require environment-based configuration, particularly those following twelve-factor app principles or working in teams with multiple deployment environments.
Developers choose GoDotEnv for its simplicity, compatibility with the original Ruby dotenv library, and seamless integration into Go projects. It reduces boilerplate code for configuration management and provides both library and command-line tool options, making it versatile for various use cases.
A Go port of Ruby's dotenv library (Loads environment variables from .env files)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Loads from multiple .env files (e.g., .env.development, .env.production) for managing different deployment stages, as detailed in the precedence conventions example.
Supports loading from files, io.Reader, strings, and YAML-style content, enabling integration beyond local files, as shown with Parse and Unmarshal functions.
The autoload package reads .env on import with zero configuration, reducing boilerplate code for quick setup, mentioned in the usage section.
Includes a bin command to run other commands with environment variables loaded from .env files, useful for scripting and development workflows, as described in command mode.
The library is declared feature complete and will not accept new functionality (per issue #182), hindering adaptation to evolving needs or community-driven enhancements.
The README states no guarantees about the command-line tool working on Windows, posing a risk for cross-platform development teams relying on the bin version.
While it aims to match Ruby and Node.js dotenv, contributions are only accepted for compatibility fixes, which may leave edge cases unresolved in multi-language projects.