# Force Update Config (Backend)

This backend exposes `GET /api/app-update-policy` from `node-api/main.js`.
The route is public and returns JSON used by the app-level force-update gate.

## Environment Variables

- `APP_FORCE_UPDATE`
  - Supported truthy values: `1`, `true`, `yes`, `on`
  - Any other value (or unset) is treated as `false`
- `APP_MIN_SUPPORTED_VERSION`
  - Minimum version allowed to continue app usage (example: `1.0.14`)
- `APP_LATEST_VERSION`
  - Informational latest version (example: `1.0.16`)
- `APP_UPDATE_MESSAGE`
  - Message shown in update prompt
- `APP_ANDROID_URL`
  - Play Store URL
- `APP_IOS_URL`
  - App Store URL
- `APP_WEB_URL`
  - Optional web update URL (if unset, frontend reloads current page)

## Sample .env Values

```env
APP_FORCE_UPDATE=true
APP_MIN_SUPPORTED_VERSION=1.0.14
APP_LATEST_VERSION=1.0.16
APP_UPDATE_MESSAGE=Please update app to continue attendance marking.
APP_ANDROID_URL=https://play.google.com/store/apps/details?id=com.dev.saxena.attendee
APP_IOS_URL=https://apps.apple.com/app/id000000000
APP_WEB_URL=
```

## Response Example

```json
{
  "forceUpdate": true,
  "minSupportedVersion": "1.0.14",
  "latestVersion": "1.0.16",
  "message": "Please update app to continue attendance marking.",
  "androidUrl": "https://play.google.com/store/apps/details?id=com.dev.saxena.attendee",
  "iosUrl": "https://apps.apple.com/app/id000000000",
  "webUrl": ""
}
```

## Manual QA Checklist

1. Set `APP_FORCE_UPDATE=true` and `APP_MIN_SUPPORTED_VERSION` higher than installed app version.
2. Launch app fresh: update modal must block before login/navigation.
3. Login and background app, then reopen: modal must still enforce on resume.
4. Set `APP_FORCE_UPDATE=false` and restart backend: app should stop blocking.
5. Web build: `Update now` reloads current page when `APP_WEB_URL` is empty.
6. Native build with missing store URL: modal stays and shows admin-contact message.
