diff --git a/debian/control b/debian/control index 40349ab2..a9a394de 100644 --- a/debian/control +++ b/debian/control @@ -1,41 +1,41 @@ Source: swh-web Maintainer: Software Heritage developers Section: python Priority: optional Build-Depends: curl, debhelper (>= 9), dh-python (>= 2), python3-all, python3-bs4, python3-django (>= 1.10.7~), python3-djangorestframework (>= 3.4.0~), python3-django-webpack-loader, python3-django-js-reverse, python3-docutils, python3-htmlmin, python3-magic (>= 0.3.0~), python3-lxml, python3-nose, python3-pygments, python3-setuptools, python3-sphinx, python3-sphinxcontrib.httpdomain, python3-yaml, - python3-swh.core (>= 0.0.20~), + python3-swh.core (>= 0.0.40~), python3-swh.model (>= 0.0.15~), - python3-swh.storage (>= 0.0.95~), - python3-swh.indexer.storage (>= 0.0.46~), - python3-swh.vault (>= 0.0.1~) + python3-swh.storage (>= 0.0.101~), + python3-swh.indexer.storage (>= 0.0.47~), + python3-swh.vault (>= 0.0.2~) Standards-Version: 3.9.6 Homepage: https://forge.softwareheritage.org/diffusion/DWUI/ Package: python3-swh.web Architecture: all -Depends: python3-swh.core (>= 0.0.20~), +Depends: python3-swh.core (>= 0.0.40~), python3-swh.model (>= 0.0.15~), - python3-swh.storage (>= 0.0.95~), - python3-swh.indexer.storage (>= 0.0.46~), - python3-swh.vault (>= 0.0.1~), + python3-swh.storage (>= 0.0.101~), + python3-swh.indexer.storage (>= 0.0.47~), + python3-swh.vault (>= 0.0.2~), ${misc:Depends}, ${python3:Depends} Description: Software Heritage Web Applications diff --git a/requirements-swh.txt b/requirements-swh.txt index ce4f053c..64a68092 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,5 +1,5 @@ -swh.core >= 0.0.20 +swh.core >= 0.0.40 swh.model >= 0.0.15 -swh.storage >= 0.0.96 -swh.vault >= 0.0.1 -swh.indexer.storage >= 0.0.46 +swh.storage >= 0.0.101 +swh.vault >= 0.0.2 +swh.indexer.storage >= 0.0.47 diff --git a/swh/web/config.py b/swh/web/config.py index c0013302..dcf5a06d 100644 --- a/swh/web/config.py +++ b/swh/web/config.py @@ -1,93 +1,95 @@ # Copyright (C) 2017-2018 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information from swh.core import config from swh.storage import get_storage from swh.indexer.storage import get_indexer_storage from swh.vault.api.client import RemoteVaultClient DEFAULT_CONFIG = { 'allowed_hosts': ('list', []), 'storage': ('dict', { 'cls': 'remote', 'args': { 'url': 'http://127.0.0.1:5002/', + 'timeout': 10, }, }), 'indexer_storage': ('dict', { 'cls': 'remote', 'args': { 'url': 'http://127.0.0.1:5007/', + 'timeout': 1, } }), 'vault': ('string', 'http://127.0.0.1:5005/'), 'log_dir': ('string', '/tmp/swh/log'), 'debug': ('bool', False), 'host': ('string', '127.0.0.1'), 'port': ('int', 5004), 'secret_key': ('string', 'development key'), # do not display code highlighting for content > 1MB 'content_display_max_size': ('int', 1024 * 1024), 'throttling': ('dict', { 'cache_uri': None, # production: memcached as cache (127.0.0.1:11211) # development: in-memory cache so None 'scopes': { 'swh_api': { 'limiter_rate': { 'default': '120/h' }, 'exempted_networks': ['127.0.0.0/8'] }, 'swh_vault_cooking': { 'limiter_rate': { 'default': '120/h', 'GET': '60/m' }, 'exempted_networks': ['127.0.0.0/8'] } } }) } swhweb_config = {} def get_config(config_file='webapp/webapp'): """Read the configuration file `config_file`, update the app with parameters (secret_key, conf) and return the parsed configuration as a dict. If no configuration file is provided, return a default configuration.""" if not swhweb_config: cfg = config.load_named_config(config_file, DEFAULT_CONFIG) swhweb_config.update(cfg) config.prepare_folders(swhweb_config, 'log_dir') swhweb_config['storage'] = get_storage(**swhweb_config['storage']) swhweb_config['vault'] = RemoteVaultClient(swhweb_config['vault']) swhweb_config['indexer_storage'] = get_indexer_storage( **swhweb_config['indexer_storage']) return swhweb_config def storage(): """Return the current application's SWH storage. """ return get_config()['storage'] def vault(): """Return the current application's SWH vault. """ return get_config()['vault'] def indexer_storage(): """Return the current application's SWH indexer storage. """ return get_config()['indexer_storage']