diff --git a/bin/swh-web-ui b/bin/swh-web-ui index 0449e6771..6d3621ff7 100755 --- a/bin/swh-web-ui +++ b/bin/swh-web-ui @@ -1,61 +1,61 @@ #!/usr/bin/env python3 # Copyright (C) 2015 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information import argparse import logging import os from swh.core import config from swh.web.ui import controller from swh.storage import Storage # Default configuration file DEFAULT_CONF_FILE = '~/.config/swh/web-ui.ini' # default configuration DEFAULT_CONF = { 'storage_args': ('list[str]', ['http://localhost:5000/']), 'storage_class': ('str', 'remote_storage'), 'log_dir': ('string', '/tmp/swh/loader-git/log'), 'debug': ('bool' , None), 'host': ('string', '127.0.0.1'), 'port': ('int' , 6543), } def parse_args(): """Parse the configuration for the cli. """ cli = argparse.ArgumentParser(description="SWH's web ui.") cli.add_argument('--verbose', '-v', action='store_true', help='Verbosity level in log file.') cli.add_argument('--config', '-c', help='configuration file path') args = cli.parse_args() return args if __name__ == '__main__': args = parse_args() conf = config.read(args.config or DEFAULT_CONF_FILE, DEFAULT_CONF) config.prepare_folders(conf, 'log_dir') if conf['storage_class'] == 'remote_storage': - from swh.storage.remote_storage import RemoteStorage as Storage + from swh.storage.api.client import RemoteStorage as Storage else: from swh.storage import Storage conf.update({ 'storage': Storage(*conf['storage_args']) }) logging.basicConfig(filename=os.path.join(conf['log_dir'], 'web-ui.log'), level=logging.DEBUG if args.verbose else logging.INFO) controller.run(conf)