diff --git a/argos/commands.py b/argos/commands.py index ed5e4a2..f12fac2 100644 --- a/argos/commands.py +++ b/argos/commands.py @@ -1,7 +1,8 @@ import asyncio -import subprocess +import os import click +import uvicorn from argos import logging from argos.agent import ArgosAgent @@ -51,16 +52,12 @@ def agent(server, auth, max_tasks, wait_time, log_level): @server.command() @click.option("--host", default="127.0.0.1", help="Host to bind") @click.option("--port", default=8000, type=int, help="Port to bind") +@click.option("--config", default="config.yaml", help="Path the the configuration file") @click.option("--reload", is_flag=True, help="Enable hot reloading") -@click.option("--log-config", help="Path to the logging configuration file") -def start(host, port, reload, log_config): +def start(host, port, config, reload): """Starts the server.""" - command = ["uvicorn", "argos.server:app", "--host", host, "--port", str(port)] - if reload: - command.append("--reload") - if log_config: - command.extend(["--log-config", log_config]) - subprocess.run(command) + os.environ["ARGOS_YAML_FILE"] = config + uvicorn.run("argos.server:app", host=host, port=port, reload=reload) @server.command()