incubator-answer icon indicating copy to clipboard operation
incubator-answer copied to clipboard

feat: add optional .env support for environment configuration

Open maishivamhoo123 opened this issue 4 weeks ago • 5 comments

Summary

This PR adds optional support for loading environment variables from a .env file to improve local development experience.

Changes

  • Load .env file at startup if it exists (ignored if missing)
  • Add .env.example with empty default values
  • Add .env to .gitignore

Backward Compatibility

  • No behavior change if .env is not present
  • Existing OS environment variables continue to work
  • Production and container-based deployments are unaffected

Related Issue

Closes #1450

maishivamhoo123 avatar Dec 23 '25 08:12 maishivamhoo123

@maishivamhoo123 You submitted language and configuration files that should not have been submitted.

LinkinStars avatar Dec 25 '25 03:12 LinkinStars

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 avatar Dec 25 '25 04:12 maishivamhoo123

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

LinkinStars avatar Dec 25 '25 04:12 LinkinStars

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.

maishivamhoo123 avatar Dec 25 '25 04:12 maishivamhoo123

@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 .

maishivamhoo123 avatar Dec 25 '25 07:12 maishivamhoo123