aboutsummaryrefslogtreecommitdiffstats
path: root/app/Middleware/Dashboard.ts
blob: 62deea0ea0e4d8e8327130d63300d40283b1d319 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
import Config from '@ioc:Adonis/Core/Config';

export default class Dashboard {
  public async handle(
    { response }: HttpContextContract,
    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();
    }
  }
}