Skip to content

fix(config): load only CORE_-prefixed environment variables - #2200

Merged
mbrandenburger merged 3 commits into
hyperledger-labs:mainfrom
jay23606:pr-go/2199-fix-config-load-only-core-prefixed-envir
Oct 29, 2026
Merged

mbrandenburger merged 3 commits into
hyperledger-labs:mainfrom
jay23606:pr-go/2199-fix-config-load-only-core-prefixed-envir

Conversation

@jay23606

@jay23606 jay23606 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Environment loading matched every variable whose name starts with CORE, while the key transform stripped CORE_. Unrelated variables such as COREPACK_ENABLE_AUTO_PIN, which Node's corepack sets on many developer machines, kept their full name and became configuration keys (corepack.enable.auto.pin). The MSP management config in platform/fabric/core/msp/mgmt had the same mismatch.

Change

  • platform/view/services/config: setupEnv filters by EnvCorePrefix (CORE_), the same prefix it strips.
  • platform/fabric/core/msp/mgmt: getConfig filters and strips with one envPrefix = "CORE_" constant.
  • TestEnvSubstitution sets COREPACK_ENABLE_AUTO_PIN alongside the CORE_ overrides and asserts no corepack.* key is loaded. TestGetConfig_EnvPrefix checks the same for the MSP config and that CORE_PEER_LOCALMSPTYPE is still read.

Testing

  • go test -race ./platform/view/services/config/... ./platform/fabric/core/msp/mgmt/... passes.
  • With the production changes reverted, TestEnvSubstitution and TestGetConfig_EnvPrefix fail on the stray corepack.enable.auto.pin key.
  • golangci-lint reports no issues in either package.

Fixes #2199

Copilot AI balanced review requested due to automatic review settings October 21, 2026 14:47
@jay23606

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Hey @jay23606 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:

  • e6d01c8 Filter configuration environment variables by CORE_ prefix
  • ceda517 fixup! Filter configuration environment variables by CORE_ prefix
  • dabb947 fixup! Filter configuration environment variables by CORE_ prefix

You'll need to sign your commits with GPG (e.g. git commit -S). See the Signing Guide for a step-by-step walkthrough.


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


❌ Issue Link -- Almost there! You are not assigned to the following linked issues: #2199.

Please ensure you are assigned to all linked issues before opening a PR. You can comment /assign on the issue to grab it!


⏳ All checks must pass before this PR can be reviewed. You've got this!

@github-actions github-actions Bot added the status: needs revision The pull request requires changes from the author before it can be reviewed or merged label Oct 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mbrandenburger

Copy link
Copy Markdown
Member

Thanks @jay23606 for opening the issue. Please start here https://github.com/hyperledger-labs/fabric-smart-client/blob/main/CONTRIBUTING.md and follow the guidelines on how to get started. Thanks

@mbrandenburger

Copy link
Copy Markdown
Member

@jay23606 shall we close this PR?

@jay23606

Copy link
Copy Markdown
Contributor Author

No, this PR still addresses the configuration bug: “Use EnvCorePrefix (CORE_) as the environment filter and add a regression test proving CORE_ overrides still apply while COREPACK_ variables are ignored.” The focused regression test passes.

@mbrandenburger

Copy link
Copy Markdown
Member

Alright, cool. In that case, can you please assign the corresponding issue yourself, then fix the PR checks as listed above.

@mbrandenburger

Copy link
Copy Markdown
Member

Hi @jay23606 Thanks again for opening this PR. Please claim the corresponding issue and cleanup the PR as advised by the bot (#2200 (comment)). Thank you for your help.

@jay23606
jay23606 force-pushed the pr-go/2199-fix-config-load-only-core-prefixed-envir branch from 6a0a01a to fd779fb Compare October 28, 2026 15:02
@mbrandenburger
mbrandenburger enabled auto-merge (squash) October 29, 2026 10:19

@mbrandenburger mbrandenburger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jay23606 for your help.

jay23606 and others added 3 commits October 29, 2026 11:25
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Filter the MSP management config by CORE_ as well, and fold the provider regression check into TestEnvSubstitution.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Use assert for the independent checks in TestGetConfig_EnvPrefix.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger
mbrandenburger force-pushed the pr-go/2199-fix-config-load-only-core-prefixed-envir branch from 196ab4f to dabb947 Compare October 29, 2026 10:25
@mbrandenburger
mbrandenburger merged commit 3fe2d6c into hyperledger-labs:main Oct 29, 2026
3 checks passed
@mergify

mergify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs revision The pull request requires changes from the author before it can be reviewed or merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(config): load only CORE_-prefixed environment variables

3 participants