This is a Cloudflare Worker written in Rust to show the in-game maintenance alert, as well as a HTML fallback for the main website.
While the existing server can handle maintenance alerts via MaintenanceOptions, it cannot do this if it needs to be taken down entirely, or if the container host needs to be restarted. A Cloudflare worker allows us to return maintenance information regardless of the status of the API.
The maintenance data is configured in wrangler.toml
. Below is an example configuration. All values are required.
[vars]
MAINTENANCE_END_DATE = "2024-05-20T18:14:08Z" # Must be ISO 8601 format.
MAINTENANCE_TITLE = "Maintenance"
MAINTENANCE_BODY = "Dawnshard is currently under maintenance\nto upgrade the server."
- Install dependencies:
pnpm i
- Start the worker in development:
pnpm run
Follow the Cloudflare documentation for guides on how to deploy the worker:
- https://developers.cloudflare.com/workers/
- https://developers.cloudflare.com/workers/get-started/guide/#4-deploy-your-project
You will need a Cloudflare account. The worker is fairly lightweight and can most likely run within the free plan.