allow to add nextcloud-aio-caddy ip-address to trusted proxies automatically

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2024-01-24 15:25:43 +01:00
parent 488a77ebdf
commit 1c8e46708f
3 changed files with 9 additions and 0 deletions

View file

@ -40,6 +40,7 @@ sed -i 's|- ip_binding: |- |' containers.yml
sed -i '/AIO_TOKEN/d' containers.yml
sed -i '/AIO_URL/d' containers.yml
sed -i '/DOCKER_SOCKET_PROXY_ENABLED/d' containers.yml
sed -i '/ADDITIONAL_TRUSTED_PROXY/d' containers.yml
TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)"
mapfile -t TCP <<< "$TCP"

View file

@ -213,6 +213,7 @@
"REMOVE_DISABLED_APPS=%REMOVE_DISABLED_APPS%",
"APACHE_PORT=%APACHE_PORT%",
"APACHE_IP_BINDING=%APACHE_IP_BINDING%",
"ADDITIONAL_TRUSTED_PROXY=%CADDY_IP_ADDRESS%",
"THIS_IS_AIO=true"
],
"stop_grace_period": 600,

View file

@ -406,6 +406,13 @@ class DockerActionManager
// Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then)
} elseif ($out[1] === 'AIO_DATABASE_HOST') {
$replacements[1] = gethostbyname('nextcloud-aio-database');
// Allow to get local ip-address of caddy container and add it to trusted proxies automatically
} elseif ($out[1] === 'CADDY_IP_ADDRESS') {
$replacements[1] = '';
$communityContainers = $this->configurationManager->GetEnabledCommunityContainers();
if (in_array('caddy', $communityContainers, true)) {
$replacements[1] = gethostbyname('nextcloud-aio-caddy');
}
} else {
$secret = $this->configurationManager->GetSecret($out[1]);
if ($secret === "") {