summaryrefslogtreecommitdiffstats
path: root/app/Middleware/Dashboard.ts
blob: 19c8cfcffacae0cba7cc2d4276c976aa889afa8f (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/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();
    }
  }
}