feat: add optional .env support for environment configuration
Summary
This PR adds optional support for loading environment variables from a .env file to improve local development experience.
Changes
- Load
.envfile at startup if it exists (ignored if missing) - Add
.env.examplewith empty default values - Add
.envto.gitignore
Backward Compatibility
- No behavior change if
.envis not present - Existing OS environment variables continue to work
- Production and container-based deployments are unaffected
Related Issue
Closes #1450
@maishivamhoo123 You submitted language and configuration files that should not have been submitted.
Sorry sir for the confusion. I won’t repeat this again. Just to confirm, I should add only the following files:
main.go
.env.example
.gitignore
README.md
go.mod @LinkinStars Sir Please let me know if this is correct. Thank you for your guidance, sir.
Sorry sir for the confusion. I won’t repeat this again. Just to confirm, I should add only the following files:
main.go
.env.example
.gitignore
README.md
go.mod @LinkinStars Sir Please let me know if this is correct. Thank you for your guidance, sir.
@maishivamhoo123 I think we can skip modifying README.md. We can add this instructions to https://answer.apache.org/docs/env
Understood, @LinkinStars sir. So instead of modifying README.md, I should add the relevant instructions to the documentation at https://answer.apache.org/docs/env . Thank you for your guidance.
@LinkinStars Sir, I hope this PR looks good now. If there are any remaining issues or further improvements needed, please let me know—I’ll be happy to address them.
Thank you for your guidance .