Changeset View
Changeset View
Standalone View
Standalone View
swh/search/cli.py
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | finally: | ||||
client.close() | client.close() | ||||
@search_cli_group.command("rpc-serve") | @search_cli_group.command("rpc-serve") | ||||
@click.argument("config-path", required=True) | @click.argument("config-path", required=True) | ||||
@click.option("--host", default="0.0.0.0", help="Host to run the server") | @click.option("--host", default="0.0.0.0", help="Host to run the server") | ||||
@click.option("--port", default=5010, type=click.INT, help="Binding port of the server") | @click.option("--port", default=5010, type=click.INT, help="Binding port of the server") | ||||
@click.option( | @click.option( | ||||
"--index-prefix", required=False, help="The prefix to add before the index names" | |||||
) | |||||
@click.option( | |||||
"--debug/--nodebug", | "--debug/--nodebug", | ||||
default=True, | default=True, | ||||
help="Indicates if the server should run in debug mode", | help="Indicates if the server should run in debug mode", | ||||
) | ) | ||||
def rpc_server(config_path, host, port, debug): | def rpc_server(config_path, host, port, index_prefix, debug): | ||||
"""Starts a Software Heritage Indexer RPC HTTP server.""" | """Starts a Software Heritage Indexer RPC HTTP server.""" | ||||
from .api.server import app, load_and_check_config | from .api.server import app, load_and_check_config | ||||
api_cfg = load_and_check_config(config_path, type="any") | api_cfg = load_and_check_config(config_path, type="any") | ||||
app.config.update(api_cfg) | app.config.update(api_cfg) | ||||
app.run(host, port=int(port), debug=bool(debug)) | app.run(host, port=int(port), index_prefix=index_prefix, debug=bool(debug)) |