diff --git a/aikido_firewall/background_process/reporter.py b/aikido_firewall/background_process/reporter.py index f11ec4bc3..db44240f6 100644 --- a/aikido_firewall/background_process/reporter.py +++ b/aikido_firewall/background_process/reporter.py @@ -14,7 +14,7 @@ from aikido_firewall import PKG_VERSION from aikido_firewall.background_process.heartbeats import send_heartbeats_every_x_secs from aikido_firewall.background_process.routes import Routes -from .reporter_config import ReporterConfig +from .service_config import ServiceConfig from aikido_firewall.ratelimiting.rate_limiter import RateLimiter @@ -29,7 +29,7 @@ def __init__(self, block, api, token, serverless, event_scheduler): self.api = api self.token = token # Should be instance of the Token class! self.routes = Routes(200) - self.conf = ReporterConfig([], get_unixtime_ms()) + self.conf = ServiceConfig([], get_unixtime_ms()) self.rate_limiter = RateLimiter( max_items=5000, time_to_live_in_ms=120 * 60 * 1000 # 120 minutes ) @@ -168,6 +168,6 @@ def update_service_config(self, res): if res["endpoints"]: if not isinstance(res["endpoints"], list): res["endpoints"] = [] # Empty list - self.conf = ReporterConfig( + self.conf = ServiceConfig( endpoints=res["endpoints"], last_updated_at=get_unixtime_ms() ) diff --git a/aikido_firewall/background_process/reporter_config.py b/aikido_firewall/background_process/service_config.py similarity index 95% rename from aikido_firewall/background_process/reporter_config.py rename to aikido_firewall/background_process/service_config.py index 6a65fa2ec..38c67aa60 100644 --- a/aikido_firewall/background_process/reporter_config.py +++ b/aikido_firewall/background_process/service_config.py @@ -5,7 +5,7 @@ from aikido_firewall.helpers.match_endpoint import match_endpoint -class ReporterConfig: +class ServiceConfig: """Class holding the config of the reporter""" def __init__(self, endpoints, last_updated_at): diff --git a/aikido_firewall/background_process/reporter_config_test.py b/aikido_firewall/background_process/service_config_test.py similarity index 73% rename from aikido_firewall/background_process/reporter_config_test.py rename to aikido_firewall/background_process/service_config_test.py index 1022d5edc..f63cc0da3 100644 --- a/aikido_firewall/background_process/reporter_config_test.py +++ b/aikido_firewall/background_process/service_config_test.py @@ -1,7 +1,7 @@ -from .reporter_config import ReporterConfig +from .service_config import ServiceConfig -def test_reporter_config_initialization(): +def test_service_config_initialization(): endpoints = [ { "graphql": False, @@ -38,10 +38,10 @@ def test_reporter_config_initialization(): }, ] last_updated_at = "2023-10-01" - reporter_config = ReporterConfig(endpoints, last_updated_at) + service_config = ServiceConfig(endpoints, last_updated_at) # Check that non-GraphQL endpoints are correctly filtered - assert len(reporter_config.endpoints) == 2 - assert reporter_config.endpoints[0]["route"] == "/v1" - assert reporter_config.endpoints[1]["route"] == "/v3" - assert reporter_config.last_updated_at == last_updated_at + assert len(service_config.endpoints) == 2 + assert service_config.endpoints[0]["route"] == "/v1" + assert service_config.endpoints[1]["route"] == "/v3" + assert service_config.last_updated_at == last_updated_at