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" | "--index-name", default="origin", required=False, help="The index name to use" | ||||
) | |||||
@click.option( | |||||
"--read-alias", | |||||
default="origin-read", | |||||
required=False, | |||||
help="The alias name used to search", | |||||
) | |||||
@click.option( | |||||
"--write-alias", | |||||
default="origin-write", | |||||
required=False, | |||||
help="The alias name used to index data", | |||||
) | ) | ||||
@click.option( | @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, index_prefix, debug): | def rpc_server(config_path, host, port, index_name, read_alias, write_alias, debug): | ||||
ardumont: I don't think that rpc-server is used by the way.
Both docker and actual production use `swh. | |||||
vsellierAuthorUnsubmitted Done Inline ActionsI agree as it's not used either in docker and puppetized environments vsellier: I agree as it's not used either in docker and puppetized environments | |||||
"""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), index_prefix=index_prefix, debug=bool(debug)) | app.run( | ||||
host, | |||||
port=int(port), | |||||
index_name=index_name, | |||||
read_alias=read_alias, | |||||
write_alias=write_alias, | |||||
debug=bool(debug), | |||||
) |
I don't think that rpc-server is used by the way.
Both docker and actual production use swh.search.api.server:make_app_from_configfile function to run.
So this begs the question to continue maintaining it (and it misses test btw) or just drop it.
@vlorentz, @vsellier what do you think?