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

feat: implements config loader to enable remote or external configs #935

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dcoric
Copy link

@dcoric dcoric commented Mar 10, 2025

This pull request introduces a significant update to the configuration management system of the GitProxy application. The main changes include adding support for multiple configuration sources, implementing a new configuration loader class, and providing the ability to reload configurations without restarting the application.

Configuration Management Enhancements:

  • Added support for multiple configuration sources in config.schema.json and proxy.config.json, allowing the configuration to be sourced from files, HTTP endpoints, or Git repositories. [1] [2]

  • Introduced a new ConfigLoader class in src/config/ConfigLoader.js to manage the loading and reloading of configurations from the specified sources. This class handles periodic reloading, merging configurations, and emitting events on configuration changes.

CLI and API Improvements:

  • Added a new CLI command reload-config in packages/git-proxy-cli/index.js to trigger a configuration reload without restarting the process. This command checks for authentication and makes a POST request to the admin API endpoint to reload the configuration. [1] [2]

  • Added a new admin-only API endpoint /api/v1/admin/reload-config in src/service/index.js to handle configuration reload requests. This endpoint validates the request, reloads the configuration, and restarts the services if necessary.

Proxy Service Enhancements:

  • Updated the proxy service in src/proxy/index.js to support stopping and restarting the HTTP and HTTPS servers, enabling the application to apply new configurations without a full restart.

Configuration Access and Updates:

  • Refactored src/config/index.js to use the new ConfigLoader and updated existing getter functions to retrieve values from the current configuration. Added functionality to handle configuration updates dynamically and restart services as needed. [1] [2] [3]fix: config loader clone command issue

This PR fixes #934

Copy link

linux-foundation-easycla bot commented Mar 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Mar 10, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 ready!

Name Link
🔨 Latest commit a73338d
🔍 Latest deploy log https://app.netlify.com/sites/endearing-brigadeiros-63f9d0/deploys/67f57d6377ba9600087dc444
😎 Deploy Preview https://deploy-preview-935--endearing-brigadeiros-63f9d0.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JamieSlome JamieSlome requested a review from 06kellyjac March 15, 2025 11:09
@dcoric
Copy link
Author

dcoric commented Mar 17, 2025

I will rebase to the latest main branch, check the failing test, and post an update afterward.

Copy link
Contributor

@06kellyjac 06kellyjac left a comment

Choose a reason for hiding this comment

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

Some suggestions and questions

@dcoric dcoric force-pushed the denis-coric/remote-config branch from aa0283d to 8d161a6 Compare March 25, 2025 13:57
Copy link

codecov bot commented Mar 31, 2025

Codecov Report

Attention: Patch coverage is 64.25121% with 74 lines in your changes missing coverage. Please review.

Project coverage is 60.54%. Comparing base (83e814b) to head (7f0a5cf).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
src/config/ConfigLoader.js 80.70% 22 Missing ⚠️
src/proxy/index.js 16.66% 20 Missing ⚠️
src/config/index.js 65.38% 18 Missing ⚠️
src/service/index.js 17.64% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #935      +/-   ##
==========================================
- Coverage   61.88%   60.54%   -1.34%     
==========================================
  Files          49       51       +2     
  Lines        1805     1967     +162     
==========================================
+ Hits         1117     1191      +74     
- Misses        688      776      +88     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JamieSlome
Copy link
Member

@dcoric - can we bolster up the code coverage? 🚀

@JamieSlome JamieSlome self-requested a review March 31, 2025 12:51
@dcoric dcoric force-pushed the denis-coric/remote-config branch from 7dea019 to 55ce8ee Compare April 2, 2025 14:37
@dcoric
Copy link
Author

dcoric commented Apr 2, 2025

@dcoric - can we bolster up the code coverage? 🚀

Done.
This helped to identify (and fix) some potential issues with validation functions 👏

dcoric added 2 commits April 8, 2025 20:48
fix: config loader clone command issue

fix: adds input validation, uses array arguments, prevented shell spawn

fix: adds failsafe checking for directory location and structure

fix: env-paths change to v2.2.1 which support require and minor code fix

fix: improves test coverage

Adds additional tests for better cove

fix: fixed creating cache directory
@dcoric dcoric force-pushed the denis-coric/remote-config branch from 7f0a5cf to a73338d Compare April 8, 2025 19:47
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.

Allow for the configuration to be sourced externally and updated at runtime
3 participants