Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 2505847

Browse files
author
Luke Hinds
authored
Merge pull request #293 from stacklok/woops
Bad merge , my bad
2 parents d01837b + 7fb3a9d commit 2505847

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

src/codegate/cli.py

Lines changed: 3 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}")
@@ -226,6 +224,7 @@ def show_prompts(prompts: Optional[Path]) -> None:
226224
type=str,
227225
default=None,
228226
help="Server key file name (default: server.key)",
227+
)
229228
@click.option(
230229
"--db-path",
231230
type=str,
@@ -246,12 +245,12 @@ def serve(
246245
ollama_url: Optional[str],
247246
model_base_path: Optional[str],
248247
embedding_model: Optional[str],
248+
db_path: Optional[str],
249249
certs_dir: Optional[str],
250250
ca_cert: Optional[str],
251251
ca_key: Optional[str],
252252
server_cert: Optional[str],
253253
server_key: Optional[str],
254-
db_path: Optional[str],
255254
) -> None:
256255
"""Start the codegate server."""
257256
try:
@@ -286,7 +285,7 @@ def serve(
286285
db_path=db_path,
287286
)
288287

289-
init_db_sync()
288+
init_db_sync(cfg.db_path)
290289

291290

292291
# Check certificates and create CA if necessary
@@ -340,11 +339,6 @@ async def run_servers(cfg: Config, app) -> None:
340339
},
341340
)
342341

343-
init_db_sync(cfg.db_path)
344-
app = init_app()
345-
346-
import uvicorn
347-
348342
# Create Uvicorn configuration
349343
uvicorn_config = UvicornConfig(
350344
app,
@@ -358,17 +352,12 @@ async def run_servers(cfg: Config, app) -> None:
358352

359353
# Initialize CopilotProvider and call run_proxy_server
360354
copilot_provider = CopilotProvider(cfg)
361-
# copilot_provider.run_proxy_server(cfg.proxy_port)
362-
363355

364356
tasks = [
365357
asyncio.create_task(server.serve()), # Uvicorn server
366358
asyncio.create_task(copilot_provider.run_proxy_server()) # Proxy server
367359
]
368360

369-
# Create and start Uvicorn server
370-
# server = UvicornServer(uvicorn_config, Server(config=uvicorn_config))
371-
372361
try:
373362
await asyncio.gather(*tasks)
374363
except asyncio.CancelledError:
@@ -386,15 +375,6 @@ async def run_servers(cfg: Config, app) -> None:
386375
except asyncio.CancelledError:
387376
pass
388377

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

424-
425404
def main() -> None:
426405
"""Main entry point for the CLI."""
427406
cli()
428407

429-
430408
if __name__ == "__main__":
431409
main()

0 commit comments

Comments
 (0)