Skip to content

Restore config.util.getEnv()#874

Merged
jdmarshall merged 1 commit intonode-config:masterfrom
jdmarshall:deprecations
Feb 10, 2026
Merged

Restore config.util.getEnv()#874
jdmarshall merged 1 commit intonode-config:masterfrom
jdmarshall:deprecations

Conversation

@jdmarshall
Copy link
Copy Markdown
Collaborator

@jdmarshall jdmarshall commented Feb 10, 2026

The env object on Load is not accessible to users of the library. This function should not have been marked as deprecated without a suitable replacement.

To resolve #871

Summary by CodeRabbit

  • New Features

    • Added a new utility method for retrieving environment variables.
  • Tests

    • Added test coverage for the environment variable retrieval functionality with proper environment setup and validation.

The env object on Load is not accessible to users of the library.
This function should not have been marked as deprecated without a
suitable replacement.
@jdmarshall jdmarshall added the bug label Feb 10, 2026
@jdmarshall jdmarshall added this to the 4.2 milestone Feb 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Introduces a new utility method util.getEnv(varName) in lib/config.js that delegates to FIRST_LOAD.getEnv() for retrieving environment variables. Adds corresponding test suite to verify the method returns expected environment variable values.

Changes

Cohort / File(s) Summary
Environment Variable Utility
lib/config.js
Adds util.getEnv(varName) method that delegates environment variable retrieval to FIRST_LOAD instance with JSDoc documentation.
Utility Tests
test/util.js
Adds test suite for util.getEnv() with proper test environment initialization (NODE_CONFIG_DIR, NODE_CONFIG_ENV); removes unused local test declarations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • markstos

Poem

🐰 A method to fetch the env with grace,
FIRST_LOAD's delegate takes its place,
Simple delegation, tested well,
Environment secrets now we'll tell!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Restore config.util.getEnv()' directly and accurately describes the main change: reinstating the getEnv() method as documented in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jdmarshall jdmarshall merged commit 89300db into node-config:master Feb 10, 2026
2 checks passed
jdmarshall added a commit that referenced this pull request Feb 10, 2026
@jdmarshall jdmarshall deleted the deprecations branch February 26, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] config.util.getEnv (and others) removed with no available replacement

1 participant