From 250d89a714700ce960721c754a221c1a17bf5ee1 Mon Sep 17 00:00:00 2001 From: kedod <35638715+kedod@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:49:26 +0100 Subject: [PATCH] feat: Add LITESTAR_ prefix before WEB_CONCURRENCY env option (#3227) * feat: Add LITESTAR_ prefix for web concurrency env option * Replace depacrated with versionchanged directive * Change wc option description * Remove depracation warning --------- Co-authored-by: kedod --- docs/usage/cli.rst | 65 ++++++++++++----------- litestar/cli/commands/core.py | 2 +- tests/unit/test_cli/test_core_commands.py | 4 +- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/docs/usage/cli.rst b/docs/usage/cli.rst index 8333d1694f..c1de49b3fe 100644 --- a/docs/usage/cli.rst +++ b/docs/usage/cli.rst @@ -103,37 +103,40 @@ The ``run`` command executes a Litestar application using `uvicorn None: type=click.IntRange(min=1, max=multiprocessing.cpu_count() + 1), show_default=True, default=1, - envvar="WEB_CONCURRENCY", + envvar=["LITESTAR_WEB_CONCURRENCY", "WEB_CONCURRENCY"], ) @option("-H", "--host", help="Server under this host", default="127.0.0.1", show_default=True, envvar="LITESTAR_HOST") @option( diff --git a/tests/unit/test_cli/test_core_commands.py b/tests/unit/test_cli/test_core_commands.py index 3400dd328b..bc709a030a 100644 --- a/tests/unit/test_cli/test_core_commands.py +++ b/tests/unit/test_cli/test_core_commands.py @@ -139,7 +139,7 @@ def test_run_command( if web_concurrency is None: web_concurrency = 1 elif set_in_env: - monkeypatch.setenv("WEB_CONCURRENCY", str(web_concurrency)) + monkeypatch.setenv("LITESTAR_WEB_CONCURRENCY", str(web_concurrency)) else: args.extend(["--web-concurrency", str(web_concurrency)]) @@ -326,7 +326,7 @@ def test_run_command_with_app_factory( ), ( ("--wc", 2), - ("WEB_CONCURRENCY", 4), + ("LITESTAR_WEB_CONCURRENCY", 4), "--workers=2", ), (