diff --git a/requirements-swh-server.txt b/requirements-swh-server.txt --- a/requirements-swh-server.txt +++ b/requirements-swh-server.txt @@ -1,4 +1,4 @@ -swh.core[http] +swh.core[http] >= 0.4 swh.loader.core >= 0.0.71 swh.scheduler >= 0.0.39 swh.model >= 0.3.8 diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1 +1 @@ -swh.core[http] >= 0.3 +swh.core[http] >= 0.4 diff --git a/swh/deposit/client.py b/swh/deposit/client.py --- a/swh/deposit/client.py +++ b/swh/deposit/client.py @@ -17,7 +17,7 @@ import requests import xmltodict -from swh.core.config import config_basepath, read_raw_config +from swh.core.config import load_from_envvar logger = logging.getLogger(__name__) @@ -79,11 +79,10 @@ """ def __init__(self, config=None, _client=requests): - if config is None: - config_file = os.environ["SWH_CONFIG_FILENAME"] - self.config: Dict[str, Any] = read_raw_config(config_basepath(config_file)) - else: + if config: self.config = config + else: + self.config: Dict[str, Any] = load_from_envvar() self._client = _client self.base_url = self.config["url"].strip("/") + "/" diff --git a/swh/deposit/config.py b/swh/deposit/config.py --- a/swh/deposit/config.py +++ b/swh/deposit/config.py @@ -94,9 +94,7 @@ """ def __init__(self): - config_file = os.environ["SWH_CONFIG_FILENAME"] - conf = config.read_raw_config(config.config_basepath(config_file)) - self.config: Dict[str, Any] = config.merge_configs(DEFAULT_CONFIG, conf) + self.config: Dict[str, Any] = config.load_from_envvar(DEFAULT_CONFIG) self.scheduler: SchedulerInterface = get_scheduler(**self.config["scheduler"]) self.tool = { "name": "swh-deposit", diff --git a/swh/deposit/loader/checker.py b/swh/deposit/loader/checker.py --- a/swh/deposit/loader/checker.py +++ b/swh/deposit/loader/checker.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information import logging -import os from typing import Any, Dict from swh.core import config @@ -21,10 +20,7 @@ """ def __init__(self): - config_file = os.environ["SWH_CONFIG_FILENAME"] - self.config: Dict[str, Any] = config.read_raw_config( - config.config_basepath(config_file) - ) + self.config: Dict[str, Any] = config.load_from_envvar() self.client = PrivateApiDepositClient(config=self.config["deposit"]) def check(self, collection: str, deposit_id: str) -> Dict[str, str]: