Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/config.py
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | |||||
class APIConfig: | class APIConfig: | ||||
"""API Configuration centralized class. This loads explicitly the configuration file out | """API Configuration centralized class. This loads explicitly the configuration file out | ||||
of the SWH_CONFIG_FILENAME environment variable. | of the SWH_CONFIG_FILENAME environment variable. | ||||
""" | """ | ||||
def __init__(self): | def __init__(self): | ||||
config_file = os.environ["SWH_CONFIG_FILENAME"] | self.config: Dict[str, Any] = config.load_from_envvar(DEFAULT_CONFIG) | ||||
conf = config.read_raw_config(config.config_basepath(config_file)) | |||||
self.config: Dict[str, Any] = config.merge_configs(DEFAULT_CONFIG, conf) | |||||
self.scheduler: SchedulerInterface = get_scheduler(**self.config["scheduler"]) | self.scheduler: SchedulerInterface = get_scheduler(**self.config["scheduler"]) | ||||
self.tool = { | self.tool = { | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": __version__, | "version": __version__, | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
} | } |