Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/api/server.py
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | ) -> Dict[str, Any]: | ||||
cfg = config.read(config_path) | cfg = config.read(config_path) | ||||
if "indexer_storage" not in cfg: | if "indexer_storage" not in cfg: | ||||
raise KeyError("Missing '%indexer_storage' configuration") | raise KeyError("Missing '%indexer_storage' configuration") | ||||
if type == "local": | if type == "local": | ||||
vcfg = cfg["indexer_storage"] | vcfg = cfg["indexer_storage"] | ||||
cls = vcfg.get("cls") | cls = vcfg.get("cls") | ||||
if cls != "local": | if cls not in ("local", "postgresql"): | ||||
raise ValueError( | raise ValueError( | ||||
"The indexer_storage backend can only be started with a " | "The indexer_storage backend can only be started with a " | ||||
"'local' configuration" | "'postgresql' configuration" | ||||
) | ) | ||||
if not vcfg.get("db"): | if not vcfg.get("db"): | ||||
raise ValueError("Invalid configuration; missing 'db' config entry") | raise ValueError("Invalid configuration; missing 'db' config entry") | ||||
return cfg | return cfg | ||||
Show All 20 Lines |