diff --git a/swh/search/cli.py b/swh/search/cli.py --- a/swh/search/cli.py +++ b/swh/search/cli.py @@ -5,6 +5,8 @@ # WARNING: do not import unnecessary things here to keep cli startup time under # control +import logging + import click from swh.core.cli import CONTEXT_SETTINGS @@ -40,6 +42,41 @@ print("Done.") +@search_cli_group.command(name="rpc-serve") +@click.option( + "--host", + default="0.0.0.0", + metavar="IP", + show_default=True, + help="Host ip address to bind the server on", +) +@click.option( + "--port", + default=5010, + type=click.INT, + metavar="PORT", + show_default=True, + help="Binding port of the server", +) +@click.option( + "--debug/--no-debug", + default=True, + help="Indicates if the server should run in debug mode", +) +@click.pass_context +def serve(ctx, host, port, debug): + """Software Heritage Storage RPC server. + + Do NOT use this in a production environment. + """ + from swh.search.api.server import app + + if "log_level" in ctx.obj: + logging.getLogger("werkzeug").setLevel(ctx.obj["log_level"]) + app.config.update(ctx.obj["config"]) + app.run(host, port=int(port), debug=bool(debug)) + + @search_cli_group.group("journal-client") @click.pass_context def journal_client(ctx): diff --git a/swh/search/translator.py b/swh/search/translator.py --- a/swh/search/translator.py +++ b/swh/search/translator.py @@ -18,7 +18,7 @@ def __init__(self): ql_rel_paths = [ "static/swh_ql.so", # installed - "../../query_language/static/swh_ql.so", # development + "../../query_language/swh_ql.so", # development ] for ql_rel_path in ql_rel_paths: ql_path = resource_filename("swh.search", ql_rel_path)