refactor: split config into remotes/virtuals/locals sections (#31)
ci/woodpecker/tag/docker Pipeline was successful
ci/woodpecker/tag/docker Pipeline was successful
Repository types now live under dedicated top-level keys instead of a shared remotes: block distinguished by a type field: remotes: caching proxy remotes (no type field needed) virtuals: virtual merged-index repositories locals: local upload repositories Routes for local repos move from /api/v1/remote/ to /api/v1/local/. config.py gains get_virtual_config() and get_local_config() lookups. Root endpoint now reports all three sections. Drop root conf.d/ (was an exact duplicate of examples/conf.d-method/). Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
@@ -147,11 +147,9 @@ _HANDLERS: dict[str, _VirtualHandler] = {
|
||||
|
||||
|
||||
async def handle(request: Request, virtual_name: str, path: str, storage, cache, config) -> Response:
|
||||
virtual_cfg = config.get_remote_config(virtual_name)
|
||||
virtual_cfg = config.get_virtual_config(virtual_name)
|
||||
if not virtual_cfg:
|
||||
raise HTTPException(status_code=404, detail=f"Virtual repository '{virtual_name}' not configured")
|
||||
if virtual_cfg.get("type") != "virtual":
|
||||
raise HTTPException(status_code=400, detail=f"'{virtual_name}' is not a virtual repository")
|
||||
|
||||
package = virtual_cfg.get("package")
|
||||
handler = _HANDLERS.get(package)
|
||||
|
||||
Reference in New Issue
Block a user