Skip to content

Commit

Permalink
overwrite APACHE_PORT, TALK_PORT and APACHE_IP_BINDING only during do…
Browse files Browse the repository at this point in the history
…ckeractionmanager

Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Oct 4, 2023
1 parent f2fee01 commit f3411f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 1 addition & 11 deletions php/src/ContainerDefinitionFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,7 @@ private function GetDefinition(): array

$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%') {
$value['port_number'] = $this->configurationManager->GetTalkPort();
}

if ($value['ip_binding'] === '%APACHE_IP_BINDING%') {
$value['ip_binding'] = $this->configurationManager->GetApacheIPBinding();
}

foreach ($entry['ports'] as $value) {
$ports->AddPort(
new ContainerPort(
$value['port_number'],
Expand Down
16 changes: 15 additions & 1 deletion php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,13 @@ public function CreateContainer(Container $container) : void {
$exposedPorts = [];
if ($container->GetInternalPort() !== 'host') {
foreach($container->GetPorts()->GetPorts() as $value) {
$portWithProtocol = $value->port . '/' . $value->protocol;
$port = $value->port;
if ($port === '%APACHE_PORT%') {
$port = $this->configurationManager->GetApachePort();
} else if ($port === '%TALK_PORT%') {
$port = $this->configurationManager->GetTalkPort();
}
$portWithProtocol = $port . '/' . $value->protocol;
$exposedPorts[$portWithProtocol] = null;
}
$requestBody['HostConfig']['NetworkMode'] = 'nextcloud-aio';
Expand All @@ -436,7 +442,15 @@ public function CreateContainer(Container $container) : void {
$requestBody['ExposedPorts'] = $exposedPorts;
foreach ($container->GetPorts()->GetPorts() as $value) {
$port = $value->port;
if ($port === '%APACHE_PORT%') {
$port = $this->configurationManager->GetApachePort();
} else if ($port === '%TALK_PORT%') {
$port = $this->configurationManager->GetTalkPort();
}
$ipBinding = $value->ipBinding;
if ($ipBinding === '%APACHE_IP_BINDING%') {
$ipBinding = $this->configurationManager->GetApacheIPBinding();
}
$protocol = $value->protocol;
$portWithProtocol = $port . '/' . $protocol;
$requestBody['HostConfig']['PortBindings'][$portWithProtocol] = [
Expand Down

0 comments on commit f3411f0

Please sign in to comment.