fix: make config read/write thread safe (#3432)

* fix: make config read/write thread safe and fix some other similar issues

1. The config config has a lock, and safe methods to update and read the attributes
2. The config has methods to retrieve copies of specific attributes, such as the extyensions config, the auth config, and the authz config.
These are needed, as the config object may mutate in the middle of an auth/authz requests, and we avoid partial configuration being applied for that request.
3. Fix an issue with the monitoring server not stopping when the controller is shut down.
4. Fix an issue with the HTPasswdWatcher not stopping when the background tasks are supposed to finish.
5. Fix some tests using hardcoded ports.

Moved some of the methods which were on the main config to the auth, access control and extension configs

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
Andrei Aaron
2025-10-18 11:20:58 +03:00
committed by GitHub
parent 2402296e9a
commit dfb5d1df54
41 changed files with 6029 additions and 661 deletions
@@ -175,8 +175,6 @@ func TestService(t *testing.T) {
onDemand.Add(service)
ctx := context.Background()
// === IMAGE SYNC CONTINUE PATH TEST ===
// Step 1: Verify empty requestStore initially
initialImageCount := 0
onDemand.requestStore.Range(func(key, value interface{}) bool {
@@ -219,8 +217,6 @@ func TestService(t *testing.T) {
So(exists, ShouldBeTrue)
So(value, ShouldEqual, struct{}{}) // Should still be pre-populated value
// === REFERRER SYNC CONTINUE PATH TEST ===
// Step 7: Verify current state before referrer test - we should have 1 request
initialReferrerCount := 0
onDemand.requestStore.Range(func(key, value interface{}) bool {