To test the maintenance mode feature, create a .env.local file in the root directory with the following configuration:
# Enable maintenance mode for testing
MAINTENANCE_MODE=true
MAINTENANCE_END_TIME=2024-12-31T23:59:59Z
MAINTENANCE_MESSAGE=We're performing scheduled maintenance to improve our services. We'll be back shortly!
MAINTENANCE_WHITELISTED_IPS=127.0.0.1,::1
MAINTENANCE_TWITTER=https://twitter.com/currentdao
MAINTENANCE_DISCORD=https://discord.gg/currentdao
MAINTENANCE_GITHUB=https://github.com/CurrentDao-org- Add the above configuration to your
.env.localfile - Start the development server:
npm run dev - Navigate to any page (e.g., http://localhost:3000)
- You should be redirected to the maintenance page with a 503 status
- The maintenance page should show:
- Countdown timer
- Social media links
- Auto-refresh functionality when maintenance ends
- Test IP whitelisting by accessing from different IPs
- Test maintenance API endpoint:
GET /api/maintenance/config
✅ Maintenance page with countdown timer ✅ Environment variable configuration ✅ IP whitelisting support ✅ Social media links ✅ Auto-refresh when maintenance ends ✅ SEO-friendly (503 status code) ✅ Next.js middleware implementation ✅ Configuration API endpoint
MAINTENANCE_MODE: Enable/disable maintenance mode (true/false)MAINTENANCE_END_TIME: ISO 8601 timestamp for maintenance endMAINTENANCE_MESSAGE: Custom maintenance messageMAINTENANCE_WHITELISTED_IPS: Comma-separated list of whitelisted IPsMAINTENANCE_TWITTER: Twitter link for status updatesMAINTENANCE_DISCORD: Discord link for status updatesMAINTENANCE_GITHUB: GitHub link for status updates