aboutsummaryrefslogtreecommitdiffstats
path: root/app/Middleware/Dashboard.ts
diff options
context:
space:
mode:
Diffstat (limited to 'app/Middleware/Dashboard.ts')
-rw-r--r--app/Middleware/Dashboard.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/Middleware/Dashboard.ts b/app/Middleware/Dashboard.ts
new file mode 100644
index 0000000..62deea0
--- /dev/null
+++ b/app/Middleware/Dashboard.ts
@@ -0,0 +1,17 @@
1import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
2import Config from '@ioc:Adonis/Core/Config';
3
4export default class Dashboard {
5 public async handle(
6 { response }: HttpContextContract,
7 next: () => Promise<void>,
8 ) {
9 if (Config.get('dashboard.enabled') === false) {
10 response.send(
11 '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.',
12 );
13 } else {
14 await next();
15 }
16 }
17}