From 8a11183cf87b86fd74c273a5662149e0d0417c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 3 Jul 2024 19:01:00 +0200 Subject: [PATCH] Fix env var in domain execution --- app/controllers/general.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/general.php b/app/controllers/general.php index 0a01a33038..a301b5430f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -251,8 +251,13 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); } + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_DOMAIN'); + $endpoint = $protocol . '://' . $hostname . "/v1"; + // Appwrite vars $vars = \array_merge($vars, [ + 'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint, 'APPWRITE_FUNCTION_ID' => $functionId, 'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name'), 'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(),