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(
305
305
ca = CertificateAuthority .get_instance ()
306
306
ca .ensure_certificates_exist ()
307
307
308
- # Set up event loop
309
- loop = asyncio .new_event_loop ()
310
- asyncio .set_event_loop (loop )
311
-
312
308
# Initialize secrets manager and pipeline factory
313
309
secrets_manager = SecretsManager ()
314
310
pipeline_factory = PipelineFactory (secrets_manager )
315
311
316
312
app = init_app (pipeline_factory )
317
313
314
+ # Set up event loop
315
+ loop = asyncio .new_event_loop ()
316
+ asyncio .set_event_loop (loop )
317
+
318
318
# Run the server
319
319
try :
320
320
loop .run_until_complete (run_servers (cfg , app ))
@@ -331,6 +331,7 @@ def serve(
331
331
logger .exception ("Unexpected error occurred" )
332
332
click .echo (f"Error: { e } " , err = True )
333
333
sys .exit (1 )
334
+
334
335
335
336
336
337
async def run_servers (cfg : Config , app ) -> None :
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ class CodegateSecrets(PipelineStep):
26
26
def __init__ (self ):
27
27
"""Initialize the CodegateSecrets pipeline step."""
28
28
super ().__init__ ()
29
+ # Initialize signatures eagerly
30
+ CodegateSignatures .initialize ("signatures.yaml" )
31
+ CodegateSignatures ._ensure_signatures_loaded ()
29
32
30
33
@property
31
34
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:
61
61
raise FileNotFoundError (f"Signatures file not found: { yaml_path } " )
62
62
63
63
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 } " )
67
69
68
70
@classmethod
69
71
def _preprocess_yaml (cls , content : str ) -> str :
Original file line number Diff line number Diff line change 4
4
from codegate import __description__ , __version__
5
5
from codegate .dashboard .dashboard import dashboard_router
6
6
from codegate .pipeline .factory import PipelineFactory
7
- from codegate .pipeline .secrets .signatures import CodegateSignatures
8
7
from codegate .providers .anthropic .provider import AnthropicProvider
9
8
from codegate .providers .llamacpp .provider import LlamaCppProvider
10
9
from codegate .providers .ollama .provider import OllamaProvider
@@ -31,9 +30,6 @@ def init_app(pipeline_factory: PipelineFactory) -> FastAPI:
31
30
# Create provider registry
32
31
registry = ProviderRegistry (app )
33
32
34
- # Initialize SignaturesFinder
35
- CodegateSignatures .initialize ("signatures.yaml" )
36
-
37
33
# Register all known providers
38
34
registry .add_provider (
39
35
"openai" ,
You can’t perform that action at this time.
0 commit comments