feat: self-contained Docker installer with web setup wizard
- settings.ts: persistent settings.json in data volume (survives restarts) - /api/setup: POST to save API_BASE_URL, API_KEY, WEB_PASSWORD, WEBHOOK_SECRET - /setup: web-based setup wizard for first-time configuration - /api/health: JSON health check endpoint for Docker healthcheck - api.ts: dynamic API_BASE_URL/API_KEY resolution from settings - login route: fallback WEB_PASSWORD from settings.json - middleware: /setup and /api/setup are public paths - Dockerfile: HEALTHCHECK instruction - docker-compose.yml: healthcheck + optional .env file - .env.example: full documentation of all env vars - install.sh: single-command VPS installer (clone, build, run)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { saveSettings, isConfigured, allSettings } from "@/lib/settings"
|
||||
|
||||
export async function GET() {
|
||||
const configured = isConfigured()
|
||||
return Response.json({ configured })
|
||||
}
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const body = await req.json()
|
||||
|
||||
const allowed = [
|
||||
"API_BASE_URL",
|
||||
"API_KEY",
|
||||
"WEB_PASSWORD",
|
||||
"WEBHOOK_SECRET",
|
||||
]
|
||||
|
||||
const toSave: Record<string, string> = {}
|
||||
for (const key of allowed) {
|
||||
if (body[key] !== undefined) {
|
||||
toSave[key] = String(body[key])
|
||||
}
|
||||
}
|
||||
|
||||
saveSettings(toSave)
|
||||
|
||||
return Response.json({ ok: true, configured: isConfigured() })
|
||||
}
|
||||
Reference in New Issue
Block a user