Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/api/server.py
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if vcfg["cls"] != "local": | ||||
raise EnvironmentError( | raise EnvironmentError( | ||||
"The vault backend can only be started with a 'local' configuration", | "The vault backend can only be started with a 'local' configuration", | ||||
) | ) | ||||
# TODO: Soft-deprecation of args key. Remove when ready. | # TODO: Soft-deprecation of args key. Remove when ready. | ||||
vcfg.update(vcfg.get("args", {})) | vcfg.update(vcfg.get("args", {})) | ||||
# Default to top-level value if any | # Default to top-level value if any | ||||
if "cache" not in vcfg: | vcfg = {**cfg, **vcfg} | ||||
vcfg["cache"] = cfg.get("cache") | |||||
if "storage" not in vcfg: | |||||
vcfg["storage"] = cfg.get("storage") | |||||
if "scheduler" not in vcfg: | |||||
vcfg["scheduler"] = cfg.get("scheduler") | |||||
if "client_max_size" not in vcfg: | |||||
vcfg["client_max_size"] = cfg.get("client_max_size") | |||||
for key in ("cache", "storage", "scheduler"): | for key in ("cache", "storage", "scheduler"): | ||||
if not vcfg.get(key): | if not vcfg.get(key): | ||||
raise ValueError(f"invalid configuration: missing {key} config entry.") | raise ValueError(f"invalid configuration: missing {key} config entry.") | ||||
return vcfg | return vcfg | ||||
Show All 39 Lines |