-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfig.php
73 lines (64 loc) · 2.16 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
return [
'debug' => true,
'languages' => true,
'cache' => [
'pages' => [
'active' => true,
],
],
// DO NOT USE BASIC AUTH IN PRODUCTION
// I only use this in my dev env to test the janitor commands
'api' => [
'basicAuth' => true,
'allowInsecure' => true,
],
'bnomei.janitor.secret' => 'e9fe51f94eadabf54',
// janitor v2 job callback
'some.key.to.task' => function ($model, $data = null) {
return [
'status' => 200,
'message' => $model->uuid().' '.$data,
'help' => 'new help from api',
];
},
'random.colors' => function ($model, $data = null) {
return [
'status' => 200,
'color' => '#'.dechex(rand(0x000000, 0xFFFFFF)), // random hex color
'backgroundColor' => '#'.dechex(rand(0x000000, 0xFFFFFF)), // random hex color
];
},
// 'bnomei.janitor.maintenance.check' => function() {
// return kirby()->users()->current()?->role()->isAdmin() !== true;
// },
'hooks' => [
'page.delete:before' => function (Kirby\Cms\Page $page, bool $force) {
// do something before a page gets deleted
undertaker($page);
},
],
'routes' => [
[
'pattern' => 'webhook/(:any)/(:any)',
'action' => function ($secret, $command) {
if ($secret != janitor()->option('secret')) {
\Kirby\Http\Header::status(401);
exit();
}
if ($command === 'backup') {
janitor()->command('janitor:backupzip --quiet');
$backup = janitor()->data('janitor:backupzip')['path'];
if (F::exists($backup)) {
\Kirby\Http\Header::download([
'mime' => F::mime($backup),
'name' => F::filename($backup),
]);
readfile($backup);
exit(); // needed to make content type work
}
}
},
],
],
];