diff --git a/swh/storage/cli.py b/swh/storage/cli.py --- a/swh/storage/cli.py +++ b/swh/storage/cli.py @@ -6,7 +6,6 @@ import functools import logging import os -import warnings import click @@ -14,7 +13,7 @@ from swh.core.cli import CONTEXT_SETTINGS from swh.journal.client import get_journal_client from swh.storage import get_storage -from swh.storage.api.server import load_and_check_config, app +from swh.storage.api.server import app try: from systemd.daemon import notify @@ -43,13 +42,14 @@ else: conf = {} - ctx.ensure_object(dict) + if "storage" not in conf: + ctx.fail("You must have a storage configured in your config file.") + ctx.ensure_object(dict) ctx.obj["config"] = conf @storage.command(name="rpc-serve") -@click.argument("config-path", default=None, required=False) @click.option( "--host", default="0.0.0.0", @@ -71,25 +71,14 @@ help="Indicates if the server should run in debug mode", ) @click.pass_context -def serve(ctx, config_path, host, port, debug): +def serve(ctx, host, port, debug): """Software Heritage Storage RPC server. Do NOT use this in a production environment. """ if "log_level" in ctx.obj: logging.getLogger("werkzeug").setLevel(ctx.obj["log_level"]) - if config_path: - # for bw compat - warnings.warn( - "The `config_path` argument of the `swh storage rpc-server` is now " - "deprecated. Please use the --config option of `swh storage` instead.", - DeprecationWarning, - ) - api_cfg = load_and_check_config(config_path, type="any") - app.config.update(api_cfg) - else: - app.config.update(ctx.obj["config"]) - + app.config.update(ctx.obj["config"]) app.run(host, port=int(port), debug=bool(debug)) @@ -161,10 +150,9 @@ from swh.storage.replay import process_replay_objects conf = ctx.obj["config"] - try: - storage = get_storage(**conf.pop("storage")) - except KeyError: - ctx.fail("You must have a storage configured in your config file.") + + storage = get_storage(**conf.pop("storage")) + client_cfg = conf.pop("journal_client") if stop_after_objects: client_cfg["stop_after_objects"] = stop_after_objects