Skip to content

Conversation

DCodeProg
Copy link
Contributor

This pull request improves the handling of default values in the Env class and adds corresponding unit tests to ensure correct behavior when optional or missing environment variables are accessed. The changes make the environment variable system more robust and reliable, especially when dealing with missing or optional keys.

Enhancements to default value handling:

  • Updated the logic in the Env.get method to return the defaultValue not only when the current value is null, but also when it is an instance of MissingValue, ensuring optional and missing variables are handled consistently.

Testing improvements:

  • Added a new optional key (optionalKey) to the test environment schema and included it in relevant test cases.
  • Added tests to verify that defaultValue is correctly returned when a variable is missing or marked as optional.
  • Minor formatting and schema adjustments in test setup for clarity and consistency.

@LeadcodeDev LeadcodeDev merged commit db5a87e into LeadcodeDev:main Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants