mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-10 08:05:22 +02:00
add maintenance mode
This commit is contained in:
parent
e8005042e2
commit
50c2c17c5b
3 changed files with 34 additions and 0 deletions
|
|
@ -4,3 +4,7 @@ BACKEND_URL=http://localhost:8000
|
|||
NEXT_PUBLIC_NODE_ENV=development
|
||||
NEXT_PUBLIC_DEPLOYMENT_MODE: "oss"
|
||||
NEXT_PUBLIC_AUTH_PROVIDER="local"
|
||||
|
||||
# Maintenance Mode
|
||||
# MAINTENANCE_MODE=true
|
||||
# MAINTENANCE_MESSAGE="We are currently performing scheduled maintenance. Please check back soon."
|
||||
|
|
|
|||
17
ui/src/app/maintenance/page.tsx
Normal file
17
ui/src/app/maintenance/page.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export default function MaintenancePage() {
|
||||
const message =
|
||||
process.env.MAINTENANCE_MESSAGE ||
|
||||
'We are currently performing scheduled maintenance. Please check back soon.';
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col items-center justify-center bg-background px-4">
|
||||
<div className="max-w-md text-center">
|
||||
<div className="mb-6 text-6xl">🔧</div>
|
||||
<h1 className="mb-4 text-2xl font-bold text-foreground">
|
||||
Under Maintenance
|
||||
</h1>
|
||||
<p className="text-muted-foreground">{message}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -9,6 +9,19 @@ function generateOSSToken(): string {
|
|||
}
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
// Check for maintenance mode
|
||||
const maintenanceMode = process.env.MAINTENANCE_MODE === 'true';
|
||||
|
||||
if (maintenanceMode) {
|
||||
// Allow access to the maintenance page itself to avoid redirect loop
|
||||
if (request.nextUrl.pathname === '/maintenance') {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// Redirect all other requests to maintenance page
|
||||
return NextResponse.redirect(new URL('/maintenance', request.url));
|
||||
}
|
||||
|
||||
const authProvider = process.env.NEXT_PUBLIC_AUTH_PROVIDER || 'stack';
|
||||
|
||||
// Only handle OSS mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue