This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed
Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -305,16 +305,16 @@ def serve(
305305 ca = CertificateAuthority .get_instance ()
306306 ca .ensure_certificates_exist ()
307307
308- # Set up event loop
309- loop = asyncio .new_event_loop ()
310- asyncio .set_event_loop (loop )
311-
312308 # Initialize secrets manager and pipeline factory
313309 secrets_manager = SecretsManager ()
314310 pipeline_factory = PipelineFactory (secrets_manager )
315311
316312 app = init_app (pipeline_factory )
317313
314+ # Set up event loop
315+ loop = asyncio .new_event_loop ()
316+ asyncio .set_event_loop (loop )
317+
318318 # Run the server
319319 try :
320320 loop .run_until_complete (run_servers (cfg , app ))
@@ -331,6 +331,7 @@ def serve(
331331 logger .exception ("Unexpected error occurred" )
332332 click .echo (f"Error: { e } " , err = True )
333333 sys .exit (1 )
334+
334335
335336
336337async def run_servers (cfg : Config , app ) -> None :
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ class CodegateSecrets(PipelineStep):
2626 def __init__ (self ):
2727 """Initialize the CodegateSecrets pipeline step."""
2828 super ().__init__ ()
29+ # Initialize signatures eagerly
30+ CodegateSignatures .initialize ("signatures.yaml" )
31+ CodegateSignatures ._ensure_signatures_loaded ()
2932
3033 @property
3134 def name (self ) -> str :
Original file line number Diff line number Diff line change @@ -61,9 +61,11 @@ def initialize(cls, yaml_path: str) -> None:
6161 raise FileNotFoundError (f"Signatures file not found: { yaml_path } " )
6262
6363 with cls ._instance_lock :
64- cls ._yaml_path = yaml_path
65- cls ._signatures_loaded = False
66- logger .debug (f"SecretFinder initialized with { yaml_path } " )
64+ # Only initialize if not already initialized with this path
65+ if cls ._yaml_path != yaml_path :
66+ cls ._yaml_path = yaml_path
67+ cls ._signatures_loaded = False
68+ logger .debug (f"SecretFinder initialized with { yaml_path } " )
6769
6870 @classmethod
6971 def _preprocess_yaml (cls , content : str ) -> str :
Original file line number Diff line number Diff line change 44from codegate import __description__ , __version__
55from codegate .dashboard .dashboard import dashboard_router
66from codegate .pipeline .factory import PipelineFactory
7- from codegate .pipeline .secrets .signatures import CodegateSignatures
87from codegate .providers .anthropic .provider import AnthropicProvider
98from codegate .providers .llamacpp .provider import LlamaCppProvider
109from codegate .providers .ollama .provider import OllamaProvider
@@ -31,9 +30,6 @@ def init_app(pipeline_factory: PipelineFactory) -> FastAPI:
3130 # Create provider registry
3231 registry = ProviderRegistry (app )
3332
34- # Initialize SignaturesFinder
35- CodegateSignatures .initialize ("signatures.yaml" )
36-
3733 # Register all known providers
3834 registry .add_provider (
3935 "openai" ,
You can’t perform that action at this time.
0 commit comments