feat: add an `env_file` configuration option to load environment variables from a file
Add env_file configuration option to load environment variables from a file
Note: Please note I'm still a beginner rustacean, so I appreciate feedback both on the code's idiomaticity and expressiveness.
This PR adds a new env_file configuration option that allows loading multiple environment variables from a file, providing an alternative to specifying them individually with the existing env option.
Features
- File-based environment loading: Use
env_file = "./.env"to load variables from a file - Standard .env format support: Supports KEY=VALUE format with comments and quoted values
- Flexible configuration: Can be set globally or per-job
- Proper priority handling: Direct
envvariables overrideenv_filevariables - Relative path resolution: Paths are resolved relative to the package directory
- Graceful error handling: Missing files generate warnings but don't fail the build
Usage Examples
Global environment file:
# bacon.toml
env_file = "./.env"
Can you please create an issue first so that we discuss whether we want this feature and its specification ?
Can you please create an issue first so that we discuss whether we want this feature and its specification ?
Sure!
Here's the proposal @Canop https://github.com/Canop/bacon/issues/376 🙏