mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-09-10 08:35:35 +08:00
add isset for non-required properties
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
f98528eac5
commit
de1eaf7707
1 changed files with 120 additions and 88 deletions
|
@ -76,8 +76,8 @@ class ContainerDefinitionFetcher
|
|||
}
|
||||
|
||||
$ports = new ContainerPorts();
|
||||
if (isset($entry['ports'])) {
|
||||
foreach ($entry['ports'] as $value) {
|
||||
|
||||
if ($value['port_number'] === '%APACHE_PORT%') {
|
||||
$value['port_number'] = $this->configurationManager->GetApachePort();
|
||||
} elseif ($value['port_number'] === '%TALK_PORT%') {
|
||||
|
@ -96,8 +96,10 @@ class ContainerDefinitionFetcher
|
|||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$volumes = new ContainerVolumes();
|
||||
if (isset($entry['volumes'])) {
|
||||
foreach ($entry['volumes'] as $value) {
|
||||
if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') {
|
||||
$value['source'] = $this->configurationManager->GetBorgBackupHostLocation();
|
||||
|
@ -140,8 +142,10 @@ class ContainerDefinitionFetcher
|
|||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$dependsOn = [];
|
||||
if (isset($entry['depends_on'])) {
|
||||
foreach ($entry['depends_on'] as $value) {
|
||||
if ($value === 'nextcloud-aio-clamav') {
|
||||
if (!$this->configurationManager->isClamavEnabled()) {
|
||||
|
@ -170,24 +174,52 @@ class ContainerDefinitionFetcher
|
|||
}
|
||||
$dependsOn[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$variables = new ContainerEnvironmentVariables();
|
||||
if (isset($entry['environment'])) {
|
||||
foreach ($entry['environment'] as $value) {
|
||||
$variables->AddVariable($value);
|
||||
}
|
||||
}
|
||||
|
||||
$displayName = '';
|
||||
if (isset($entry['display_name'])) {
|
||||
$displayName = $entry['display_name'];
|
||||
}
|
||||
|
||||
$restartPolicy = '';
|
||||
if (isset($entry['restart'])) {
|
||||
$restartPolicy = $entry['restart'];
|
||||
}
|
||||
|
||||
$maxShutdownTime = 10;
|
||||
if (isset($entry['stop_grace_period'])) {
|
||||
$maxShutdownTime = $entry['stop_grace_period'];
|
||||
}
|
||||
|
||||
$internalPort = '';
|
||||
if (isset($entry['internal_port'])) {
|
||||
$internalPort = $entry['internal_port'];
|
||||
}
|
||||
|
||||
$secrets = [];
|
||||
if (isset($entry['secrets'])) {
|
||||
$secrets = $entry['secrets'];
|
||||
}
|
||||
|
||||
$containers[] = new Container(
|
||||
$entry['container_name'],
|
||||
$entry['display_name'],
|
||||
$displayName,
|
||||
$entry['image'],
|
||||
$entry['restart'],
|
||||
$entry['stop_grace_period'],
|
||||
$restartPolicy,
|
||||
$maxShutdownTime,
|
||||
$ports,
|
||||
$entry['internal_port'],
|
||||
$internalPort,
|
||||
$volumes,
|
||||
$variables,
|
||||
$dependsOn,
|
||||
$entry['secrets'],
|
||||
$secrets,
|
||||
$this->container->get(DockerActionManager::class)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue