Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: try to refactor the load config coode to 2 clear pathes #814

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

qs-wang
Copy link

@qs-wang qs-wang commented Jan 11, 2025

  • split loadConfigByProvider to a separate method to make if/else statement clearer
  • split loadPrivateConfigFromFile to a separate method for reuse in if/else branches

I tried to make some changes for my own purpose. While I read the code although the code works perfectly, it a little bit hard to understand and change because the config loading logic from the provider and file are mixed. I refactored it to split the loading logic , i.e. loading from provider and file, to 2 methods, which made my changes easier. Later on I found other solution so the changes got dropped, but I am trying to push the refactor to see if anyone is interested.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • [y] I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • [y] I am not introducing a new dependency (add notes below if you are)
  • [n] I have added unit tests for the new feature or bug fix (if not, why?) refactoring the code, should not change any logic, passed all existing test
  • [y] I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • [n] I have opened a PR for the related docs change (if not, why?) refactoring code, no doc change is needed

Testing Instructions

New Dependency Instructions (If applicable)

@qs-wang qs-wang force-pushed the refactor/load-config branch 4 times, most recently from eea340f to d3f9d8c Compare January 11, 2025 11:03
…th clearly

- split loadConfigByProvider to a separate method to make if/else statemtn clearer
- split loadPrivateConfigFromFile to a separate method for reuse in if/else branches

Signed-off-by: Q.s <[email protected]>
@qs-wang qs-wang force-pushed the refactor/load-config branch from d3f9d8c to f6565fc Compare January 11, 2025 11:05
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.

1 participant