Skip to content

Commit 7fb3a9d

Browse files
author
Luke Hinds
committed
Fix wonky merge
1 parent 9a16b96 commit 7fb3a9d

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

src/codegate/cli.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def __init__(self, config: UvicornConfig, server: Server):
3333
self._shutdown_event = asyncio.Event()
3434
self._should_exit = False
3535

36-
37-
3836
async def serve(self) -> None:
3937
"""Start the uvicorn server and handle shutdown gracefully."""
4038
logger.debug(f"Starting server on {self.host}:{self.port}")
@@ -247,12 +245,12 @@ def serve(
247245
ollama_url: Optional[str],
248246
model_base_path: Optional[str],
249247
embedding_model: Optional[str],
248+
db_path: Optional[str],
250249
certs_dir: Optional[str],
251250
ca_cert: Optional[str],
252251
ca_key: Optional[str],
253252
server_cert: Optional[str],
254253
server_key: Optional[str],
255-
db_path: Optional[str],
256254
) -> None:
257255
"""Start the codegate server."""
258256
try:
@@ -287,7 +285,7 @@ def serve(
287285
db_path=db_path,
288286
)
289287

290-
init_db_sync()
288+
init_db_sync(cfg.db_path)
291289

292290

293291
# Check certificates and create CA if necessary
@@ -341,11 +339,6 @@ async def run_servers(cfg: Config, app) -> None:
341339
},
342340
)
343341

344-
init_db_sync(cfg.db_path)
345-
app = init_app()
346-
347-
import uvicorn
348-
349342
# Create Uvicorn configuration
350343
uvicorn_config = UvicornConfig(
351344
app,
@@ -359,17 +352,12 @@ async def run_servers(cfg: Config, app) -> None:
359352

360353
# Initialize CopilotProvider and call run_proxy_server
361354
copilot_provider = CopilotProvider(cfg)
362-
# copilot_provider.run_proxy_server(cfg.proxy_port)
363-
364355

365356
tasks = [
366357
asyncio.create_task(server.serve()), # Uvicorn server
367358
asyncio.create_task(copilot_provider.run_proxy_server()) # Proxy server
368359
]
369360

370-
# Create and start Uvicorn server
371-
# server = UvicornServer(uvicorn_config, Server(config=uvicorn_config))
372-
373361
try:
374362
await asyncio.gather(*tasks)
375363
except asyncio.CancelledError:
@@ -387,15 +375,6 @@ async def run_servers(cfg: Config, app) -> None:
387375
except asyncio.CancelledError:
388376
pass
389377

390-
391-
# Set up signal handlers
392-
# loop = asyncio.get_running_loop()
393-
# for sig in (signal.SIGTERM, signal.SIGINT):
394-
# loop.add_signal_handler(sig, lambda: asyncio.create_task(server.cleanup()))
395-
396-
# # Start server
397-
# await server.serve()
398-
399378
except Exception as e:
400379
logger.exception("Error running servers")
401380
raise e
@@ -422,11 +401,9 @@ def restore_backup(backup_path: Path, backup_name: str) -> None:
422401
click.echo(f"Error restoring backup: {e}", err=True)
423402
sys.exit(1)
424403

425-
426404
def main() -> None:
427405
"""Main entry point for the CLI."""
428406
cli()
429407

430-
431408
if __name__ == "__main__":
432409
main()

0 commit comments

Comments
 (0)