generated from coulomb/repo-seed
Align naming with coulomb.social reuse-surface conventions
Some checks failed
ci / validate-registry (push) Has been cancelled
Some checks failed
ci / validate-registry (push) Has been cancelled
Use reuse.coulomb.social, REUSE_SURFACE_URL/TOKEN env vars, reuse-surface image and reuse-surface-env secret. Replace reuse-surface-hub entrypoint with reuse-surface serve; CLI uses --base-url.
This commit is contained in:
@@ -15,15 +15,15 @@ HUB_VERSION = "0.1.0"
|
||||
|
||||
|
||||
def _db_path() -> Path:
|
||||
return Path(os.environ.get("REUSE_SURFACE_HUB_DB", "/data/hub.db"))
|
||||
return Path(os.environ.get("REUSE_SURFACE_DB", "/data/reuse.db"))
|
||||
|
||||
|
||||
def _cache_dir() -> Path:
|
||||
return Path(os.environ.get("REUSE_SURFACE_HUB_CACHE_DIR", "/data/cache"))
|
||||
return Path(os.environ.get("REUSE_SURFACE_CACHE_DIR", "/data/cache"))
|
||||
|
||||
|
||||
def _write_token() -> str:
|
||||
return os.environ.get("REUSE_SURFACE_HUB_TOKEN", "")
|
||||
return os.environ.get("REUSE_SURFACE_TOKEN", "")
|
||||
|
||||
|
||||
def _store() -> HubStore:
|
||||
@@ -41,7 +41,7 @@ def _require_auth(authorization: str | None = Header(default=None)) -> None:
|
||||
write_token = _write_token()
|
||||
if not write_token:
|
||||
raise _http_error(
|
||||
503, "misconfigured", "REUSE_SURFACE_HUB_TOKEN is not configured"
|
||||
503, "misconfigured", "REUSE_SURFACE_TOKEN is not configured"
|
||||
)
|
||||
if not authorization or not authorization.startswith("Bearer "):
|
||||
raise _http_error(401, "unauthorized", "Bearer token required")
|
||||
@@ -56,7 +56,7 @@ def create_app() -> FastAPI:
|
||||
|
||||
@app.get("/health")
|
||||
def health() -> dict[str, str]:
|
||||
return {"status": "ok", "service": "reuse-surface-hub", "version": HUB_VERSION}
|
||||
return {"status": "ok", "service": "reuse-surface", "version": HUB_VERSION}
|
||||
|
||||
@app.get("/v1/repos")
|
||||
def list_repos() -> dict[str, Any]:
|
||||
@@ -138,6 +138,6 @@ def create_app() -> FastAPI:
|
||||
def main() -> None:
|
||||
import uvicorn
|
||||
|
||||
host = os.environ.get("REUSE_SURFACE_HUB_HOST", "0.0.0.0")
|
||||
port = int(os.environ.get("REUSE_SURFACE_HUB_PORT", "8000"))
|
||||
host = os.environ.get("REUSE_SURFACE_HOST", "0.0.0.0")
|
||||
port = int(os.environ.get("REUSE_SURFACE_PORT", "8000"))
|
||||
uvicorn.run(create_app(), host=host, port=port, reload=False)
|
||||
Reference in New Issue
Block a user