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
|
<?php
namespace ServiceDefinitions;
class ServiceDefinition
{
public $name;
public $prettyName;
public $containerName;
public $luks;
public function __construct($name, $prettyName, $containerName, $luks)
{
$this->name = $name;
$this->prettyName = $prettyName;
$this->containerName = $containerName;
$this->luks = $luks;
}
}
class LuksDataDisk
{
public $deviceName;
public $uuid;
public $mountPoint;
public function __construct($deviceName, $uuid, $mountPoint)
{
$this->deviceName = $deviceName;
$this->uuid = $uuid;
$this->mountPoint = $mountPoint;
}
}
$services = [
new ServiceDefinition('vaultwarden', 'Vaultwarden', 'vaultwarden', null),
new ServiceDefinition('nextcloud', 'Nextcloud', ['nextcloud', 'nextcloud_db'], new LuksDataDisk('mmcblk0p3', '19537ab9-d855-416c-99c3-ebc85e02bfbf', 'cloud')),
new ServiceDefinition('jellyfin', 'Jellyfin', 'jellyfin', new LuksDataDisk('sda', '12158df0-2738-4c32-a7b9-36c11dde427f', 'media')),
new ServiceDefinition('minecraft', 'Minecraft server', 'minecraft', null),
];
function getServiceDefinition($name) {
global $services;
$matching = array_filter($services, function ($service) use ($name) { return $service->name === $name; });
if (count($matching) === 0) {
return null;
}
return reset($matching);
}
?>
|