aboutsummaryrefslogtreecommitdiffstats
path: root/app/Middleware/Dashboard.ts
blob: 20113b74bfb9cc79cce381dfa63be66335e49ad2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import type { HttpContext } from '@adonisjs/core/http';
import config from '@adonisjs/core/services/config';

export default class Dashboard {
  public async handle({ response }: HttpContext, next: () => Promise<void>) {
    if (config.get('dashboard.enabled') === false) {
      response.send(
        'The user dashboard is disabled on this server\n\nIf you are the server owner, please set IS_DASHBOARD_ENABLED to true to enable the dashboard.',
      );
    } else {
      await next();
    }
  }
}