whatevs
This commit is contained in:
@@ -24,6 +24,8 @@ _ROOT = Path(__file__).parent.parent
|
||||
pages_dir: Path = _ROOT / os.environ.get("WIKI_PAGES_DIR", "site/src/content/entries")
|
||||
stories_dir: Path = _ROOT / os.environ.get("WIKI_STORIES_DIR", "site/src/content/blog")
|
||||
site_dir: Path = _ROOT / "site"
|
||||
# On VPS, copy built dist here so nginx can serve from /var/www with proper permissions.
|
||||
_wiki_webroot: Path | None = Path(os.environ["WIKI_WEBROOT"]) if os.environ.get("WIKI_WEBROOT") else None
|
||||
|
||||
# Shared DB with bincio_activity.
|
||||
# Dev default: /tmp/bincio_dev_test/instance.db (created by bincio_activity dev_test.py --fresh).
|
||||
@@ -284,6 +286,13 @@ async def rebuild(user: User = Depends(require_auth)) -> JSONResponse:
|
||||
except asyncio.TimeoutError:
|
||||
proc.kill()
|
||||
raise HTTPException(504, "Build timed out after 120s")
|
||||
if proc.returncode == 0 and _wiki_webroot:
|
||||
sync = await asyncio.create_subprocess_exec(
|
||||
"rsync", "-a", "--delete",
|
||||
str(site_dir / "dist") + "/",
|
||||
str(_wiki_webroot) + "/",
|
||||
)
|
||||
await sync.wait()
|
||||
return JSONResponse({
|
||||
"success": proc.returncode == 0,
|
||||
"stdout": stdout.decode()[-3000:] if stdout else "",
|
||||
|
||||
Reference in New Issue
Block a user