Skip to content

Commit

Permalink
fix: Only enable the scheduler where it's desired
Browse files Browse the repository at this point in the history
  • Loading branch information
beverloo committed Jan 7, 2025
1 parent 57e102b commit f30db57
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.development.sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ APP_ENVIRONMENT_OVERRIDE="stewards.team"
APP_PASSRESET_PASSWORD="my_password"
APP_PASSWORD_SALT="my_salt"
APP_REGISTRATION_PASSWORD="my_password"
APP_SCHEDULER_ENABLED="0"
APP_SCHEDULER_PASSWORD="my_password"
NEXT_PUBLIC_MUI_LICENSE_KEY="YOUR_LICENSE_KEY"
1 change: 1 addition & 0 deletions .env.production.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ APP_DATABASE_NAME="database_name"
APP_PASSRESET_PASSWORD="my_password"
APP_PASSWORD_SALT="my_salt"
APP_REGISTRATION_PASSWORD="my_password"
APP_SCHEDULER_ENABLED="1"
APP_SCHEDULER_PASSWORD="my_password"
NEXT_PUBLIC_MUI_LICENSE_KEY="YOUR_LICENSE_KEY"
6 changes: 6 additions & 0 deletions app/admin/system/scheduler/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import type { Metadata } from 'next';

import Alert from '@mui/material/Alert';

import { SchedulerCreateTaskPanel } from './SchedulerCreateTaskPanel';
import { SchedulerTaskTable } from './SchedulerTaskTable';
import { requireAuthenticationContext } from '@lib/auth/AuthenticationContext';
Expand All @@ -19,6 +21,10 @@ export default async function SchedulerPage() {

return (
<>
{ process.env.APP_SCHEDULER_ENABLED !== '1' &&
<Alert severity="error" variant="filled">
The scheduler is not running on this Volunteer Manager instance.
</Alert> }
<SchedulerTaskTable />
<SchedulerCreateTaskPanel />
</>
Expand Down
2 changes: 1 addition & 1 deletion instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function register() {
return;
}

if (process.env.NODE_ENV !== 'production' && !process.env.APP_USE_SCHEDULER) {
if (process.env.NODE_ENV !== 'production' && process.env.APP_SCHEDULER_ENABLED !== '1') {
// Fail silent: this is intentionally done by the developer.
return;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build-staging": "node Docker.build.js 3002 volunteer-manager-staging",
"build-with-bundle-analyzer": "cross-env ANALYZE=true next build",
"serve": "next dev --turbo",
"serve-with-scheduler": "cross-env APP_USE_SCHEDULER=1 next dev --turbo",
"serve-with-scheduler": "cross-env APP_SCHEDULER_ENABLED=1 next dev --turbo",
"lint": "next lint",
"test": "jest",
"test:e2e": "playwright test --reporter=html"
Expand Down

0 comments on commit f30db57

Please sign in to comment.