Merge branch 'main' of https://github.com/appwrite/appwrite into collection-not-found

 Conflicts:
	composer.lock
This commit is contained in:
fogelito 2024-04-09 17:56:52 +03:00
commit 6edd0ea90d
117 changed files with 494 additions and 468 deletions

View file

@ -66,7 +66,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \ --volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \ --entrypoint="install" \
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
### Windows ### Windows
@ -78,7 +78,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^ --volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^ --entrypoint="install" ^
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
#### PowerShell #### PowerShell
@ -88,7 +88,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock ` --volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" ` --entrypoint="install" `
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。

View file

@ -76,7 +76,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \ --volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \ --entrypoint="install" \
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
### Windows ### Windows
@ -88,7 +88,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^ --volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^ --entrypoint="install" ^
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
#### PowerShell #### PowerShell
@ -98,7 +98,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock ` --volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" ` --entrypoint="install" `
appwrite/appwrite:1.5.3 appwrite/appwrite:1.5.4
``` ```
Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation.

View file

@ -8,7 +8,6 @@ use Appwrite\Event\Delete;
use Appwrite\Event\Func; use Appwrite\Event\Func;
use Appwrite\Event\Hamster; use Appwrite\Event\Hamster;
use Appwrite\Platform\Appwrite; use Appwrite\Platform\Appwrite;
use Utopia\App;
use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
use Utopia\CLI\CLI; use Utopia\CLI\CLI;
@ -22,6 +21,7 @@ use Utopia\Platform\Service;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\Queue\Connection; use Utopia\Queue\Connection;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\System\System;
Authorization::disable(); Authorization::disable();
@ -145,7 +145,7 @@ CLI::setResource('logError', function (Registry $register) {
$logger = $register->get('logger'); $logger = $register->get('logger');
if ($logger) { if ($logger) {
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
$log = new Log(); $log = new Log();
$log->setNamespace($namespace); $log->setNamespace($namespace);
@ -164,7 +164,7 @@ CLI::setResource('logError', function (Registry $register) {
$log->setAction($action); $log->setAction($action);
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Baie dankie", "emails.verification.thanks": "Baie dankie",
"emails.verification.signature": "Die {{project}} span", "emails.verification.signature": "Die {{project}} span",
"emails.magicSession.subject": "Teken aan", "emails.magicSession.subject": "Teken aan",
"emails.magicSession.hello": "Goeie dag,", "emails.magicSession.hello": "Goeie dag",
"emails.magicSession.body": "Volg hierdie skakel om in te teken.", "emails.magicSession.body": "Volg hierdie skakel om in te teken.",
"emails.magicSession.footer": "Ignoreer gerus hierdie boodskap as u nie die versoek gestuur het om met die' adres in te teken nie.", "emails.magicSession.footer": "Ignoreer gerus hierdie boodskap as u nie die versoek gestuur het om met die' adres in te teken nie.",
"emails.magicSession.thanks": "Baie dankie", "emails.magicSession.thanks": "Baie dankie",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "شكرا", "emails.verification.thanks": "شكرا",
"emails.verification.signature": "فريق {{project}}", "emails.verification.signature": "فريق {{project}}",
"emails.magicSession.subject": "تسجيل الدخول", "emails.magicSession.subject": "تسجيل الدخول",
"emails.magicSession.hello": "أهلا،", "emails.magicSession.hello": "أهلا",
"emails.magicSession.body": "اتبع هذا الرابط لتسجيل الدخول", "emails.magicSession.body": "اتبع هذا الرابط لتسجيل الدخول",
"emails.magicSession.footer": "لو لم تطلب تسجيل الدخول بهذا البريد الاكتروني ، يمكنك تجاهل هذه الرسالة", "emails.magicSession.footer": "لو لم تطلب تسجيل الدخول بهذا البريد الاكتروني ، يمكنك تجاهل هذه الرسالة",
"emails.magicSession.thanks": "شكرا", "emails.magicSession.thanks": "شكرا",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ধন্যবাদ", "emails.verification.thanks": "ধন্যবাদ",
"emails.verification.signature": "{{project}} দল", "emails.verification.signature": "{{project}} দল",
"emails.magicSession.subject": "লগইন", "emails.magicSession.subject": "লগইন",
"emails.magicSession.hello": "নমস্কাৰ,", "emails.magicSession.hello": "নমস্কাৰ",
"emails.magicSession.body": "লগইন কৰিবলৈ এই লিংকটো অনুসৰণ কৰক।", "emails.magicSession.body": "লগইন কৰিবলৈ এই লিংকটো অনুসৰণ কৰক।",
"emails.magicSession.footer": "যদি আপুনি এই ইমেইল ব্যৱহাৰ কৰি লগইন কৰিবলৈ কোৱা নাছিল, আপুনি এই বাৰ্তাটো উপেক্ষা কৰিব পাৰে।", "emails.magicSession.footer": "যদি আপুনি এই ইমেইল ব্যৱহাৰ কৰি লগইন কৰিবলৈ কোৱা নাছিল, আপুনি এই বাৰ্তাটো উপেক্ষা কৰিব পাৰে।",
"emails.magicSession.thanks": "ধন্যবাদ", "emails.magicSession.thanks": "ধন্যবাদ",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Təşəkkürlər", "emails.verification.thanks": "Təşəkkürlər",
"emails.verification.signature": "{{project}} komandası", "emails.verification.signature": "{{project}} komandası",
"emails.magicSession.subject": "Daxil Olmaq", "emails.magicSession.subject": "Daxil Olmaq",
"emails.magicSession.hello": "Salam,", "emails.magicSession.hello": "Salam",
"emails.magicSession.body": "Daxil olmaq üçün bu linki izləyin.", "emails.magicSession.body": "Daxil olmaq üçün bu linki izləyin.",
"emails.magicSession.footer": "Bu e-poçtdan istifadə edərək giriş istəməmisinizsə, bu mesajı görməməzlikdən gələ bilərsiniz.", "emails.magicSession.footer": "Bu e-poçtdan istifadə edərək giriş istəməmisinizsə, bu mesajı görməməzlikdən gələ bilərsiniz.",
"emails.magicSession.thanks": "Təşəkkürlər", "emails.magicSession.thanks": "Təşəkkürlər",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Дзякуем", "emails.verification.thanks": "Дзякуем",
"emails.verification.signature": "каманда {{project}}", "emails.verification.signature": "каманда {{project}}",
"emails.magicSession.subject": "Лагін", "emails.magicSession.subject": "Лагін",
"emails.magicSession.hello": "Прывітанне,", "emails.magicSession.hello": "Прывітанне",
"emails.magicSession.body": "Перайдзіце па спасылцы, каб увайсці.", "emails.magicSession.body": "Перайдзіце па спасылцы, каб увайсці.",
"emails.magicSession.footer": "Калі вы не прасілі ўвайсці, выкарыстоўваючы гэты адрас электроннай пошты, праігнаруйце гэтае паведамленне.", "emails.magicSession.footer": "Калі вы не прасілі ўвайсці, выкарыстоўваючы гэты адрас электроннай пошты, праігнаруйце гэтае паведамленне.",
"emails.magicSession.thanks": "Дзякуем", "emails.magicSession.thanks": "Дзякуем",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Gràcies", "emails.verification.thanks": "Gràcies",
"emails.verification.signature": "Equip {{project}}", "emails.verification.signature": "Equip {{project}}",
"emails.magicSession.subject": "Entrar", "emails.magicSession.subject": "Entrar",
"emails.magicSession.hello": "Hola,", "emails.magicSession.hello": "Hola",
"emails.magicSession.body": "Accedeix a aquest enllaç per a entrar.", "emails.magicSession.body": "Accedeix a aquest enllaç per a entrar.",
"emails.magicSession.footer": "Si no has sol·licitat entrar amb aquesta adreça electrònica, pots ignorar aquest missatge.", "emails.magicSession.footer": "Si no has sol·licitat entrar amb aquesta adreça electrònica, pots ignorar aquest missatge.",
"emails.magicSession.thanks": "Gràcies", "emails.magicSession.thanks": "Gràcies",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Tak", "emails.verification.thanks": "Tak",
"emails.verification.signature": "{{project}} team", "emails.verification.signature": "{{project}} team",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Hej,", "emails.magicSession.hello": "Hej",
"emails.magicSession.body": "Følg dette link for at logge ind.", "emails.magicSession.body": "Følg dette link for at logge ind.",
"emails.magicSession.footer": "Hvis du ikke har bedt om at logge ind med denne email, ignorer venligst denne besked.", "emails.magicSession.footer": "Hvis du ikke har bedt om at logge ind med denne email, ignorer venligst denne besked.",
"emails.magicSession.thanks": "Tak", "emails.magicSession.thanks": "Tak",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Danke", "emails.verification.thanks": "Danke",
"emails.verification.signature": "{{project}}-Team", "emails.verification.signature": "{{project}}-Team",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Hey,", "emails.magicSession.hello": "Hey",
"emails.magicSession.body": "Folge diesem Link, um dich einzuloggen.", "emails.magicSession.body": "Folge diesem Link, um dich einzuloggen.",
"emails.magicSession.footer": "Solltest du keinen Login für diese E-Mail-Adresse angefordert haben, kannst du diese Nachricht ignorieren.", "emails.magicSession.footer": "Solltest du keinen Login für diese E-Mail-Adresse angefordert haben, kannst du diese Nachricht ignorieren.",
"emails.magicSession.thanks": "Danke", "emails.magicSession.thanks": "Danke",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Ευχαριστούμε", "emails.verification.thanks": "Ευχαριστούμε",
"emails.verification.signature": "Η ομάδα του {{project}}", "emails.verification.signature": "Η ομάδα του {{project}}",
"emails.magicSession.subject": "Είσοδος", "emails.magicSession.subject": "Είσοδος",
"emails.magicSession.hello": "Γεια σου,", "emails.magicSession.hello": "Γεια σου",
"emails.magicSession.body": "Ακολουθήστε αυτό το link για να συνδεθείτε", "emails.magicSession.body": "Ακολουθήστε αυτό το link για να συνδεθείτε",
"emails.magicSession.footer": "Εάν δεν ζητήσατε να συνδεθείτε χρησιμοποιώντας αυτό το email, μπορείτε να αγνοήσετε αυτό το μήνυμα.", "emails.magicSession.footer": "Εάν δεν ζητήσατε να συνδεθείτε χρησιμοποιώντας αυτό το email, μπορείτε να αγνοήσετε αυτό το μήνυμα.",
"emails.magicSession.thanks": "Ευχαριστούμε", "emails.magicSession.thanks": "Ευχαριστούμε",

View file

@ -9,7 +9,7 @@
"emails.verification.thanks": "Dankegon.", "emails.verification.thanks": "Dankegon.",
"emails.verification.signature": "Teamo {{project}}", "emails.verification.signature": "Teamo {{project}}",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Saluton,", "emails.magicSession.hello": "Saluton",
"emails.magicSession.body": "Alklaku ĉi tiun ligon por eniri.", "emails.magicSession.body": "Alklaku ĉi tiun ligon por eniri.",
"emails.magicSession.footer": "Se vi ne petis ĉi tiun konfirmon de ĉi tiu retpoŝto, vi povas ignori ĉi tiun mesaĝon.", "emails.magicSession.footer": "Se vi ne petis ĉi tiun konfirmon de ĉi tiu retpoŝto, vi povas ignori ĉi tiun mesaĝon.",
"emails.magicSession.thanks": "Dankegon", "emails.magicSession.thanks": "Dankegon",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Merci", "emails.verification.thanks": "Merci",
"emails.verification.signature": "Équipe {{project}}", "emails.verification.signature": "Équipe {{project}}",
"emails.magicSession.subject": "Connexion", "emails.magicSession.subject": "Connexion",
"emails.magicSession.hello": "Bonjour,", "emails.magicSession.hello": "Bonjour",
"emails.magicSession.body": "Suivez ce lien pour vous connecter.", "emails.magicSession.body": "Suivez ce lien pour vous connecter.",
"emails.magicSession.footer": "Si vous n'avez pas demandé à vous connecter en utilisant cet e-mail, vous pouvez ignorer ce message.", "emails.magicSession.footer": "Si vous n'avez pas demandé à vous connecter en utilisant cet e-mail, vous pouvez ignorer ce message.",
"emails.magicSession.thanks": "Merci", "emails.magicSession.thanks": "Merci",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Go raibh maith agat", "emails.verification.thanks": "Go raibh maith agat",
"emails.verification.signature": "{{project}} foireann", "emails.verification.signature": "{{project}} foireann",
"emails.magicSession.subject": "Logáil isteach", "emails.magicSession.subject": "Logáil isteach",
"emails.magicSession.hello": "Haigh,", "emails.magicSession.hello": "Haigh",
"emails.magicSession.body": "Lean an nasc seo chun logáil isteach.", "emails.magicSession.body": "Lean an nasc seo chun logáil isteach.",
"emails.magicSession.footer": "Mura ndearna tú iarratas logáil isteach leis an ríomhphost seo, déan neamhaird den teachtaireacht seo.", "emails.magicSession.footer": "Mura ndearna tú iarratas logáil isteach leis an ríomhphost seo, déan neamhaird den teachtaireacht seo.",
"emails.magicSession.thanks": "Go raibh maith agat", "emails.magicSession.thanks": "Go raibh maith agat",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "આભાર", "emails.verification.thanks": "આભાર",
"emails.verification.signature": "{{project}} ટીમ", "emails.verification.signature": "{{project}} ટીમ",
"emails.magicSession.subject": "પ્રવેશ કરો", "emails.magicSession.subject": "પ્રવેશ કરો",
"emails.magicSession.hello": "નમસ્કાર,", "emails.magicSession.hello": "નમસ્કાર",
"emails.magicSession.body": "પ્રવેશ કરવા માટે આ લિંકને અનુસરો.", "emails.magicSession.body": "પ્રવેશ કરવા માટે આ લિંકને અનુસરો.",
"emails.magicSession.footer": "જો તમે આ ઇમેઇલનો ઉપયોગ કરીને પ્રવેશ કરવાનું ન કહ્યું હોય, તો તમે આ સંદેશને અવગણી શકો છો.", "emails.magicSession.footer": "જો તમે આ ઇમેઇલનો ઉપયોગ કરીને પ્રવેશ કરવાનું ન કહ્યું હોય, તો તમે આ સંદેશને અવગણી શકો છો.",
"emails.magicSession.thanks": "આભાર", "emails.magicSession.thanks": "આભાર",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "תודה", "emails.verification.thanks": "תודה",
"emails.verification.signature": "צוות {{project}}", "emails.verification.signature": "צוות {{project}}",
"emails.magicSession.subject": "כניסה למערכת", "emails.magicSession.subject": "כניסה למערכת",
"emails.magicSession.hello": "שלום,", "emails.magicSession.hello": "שלום",
"emails.magicSession.body": "לחץ על קישור זה כדי להיכנס.", "emails.magicSession.body": "לחץ על קישור זה כדי להיכנס.",
"emails.magicSession.footer": "אם לא ביקשת להיכנס באמצעות דוא\"ל זה, תוכל להתעלם מהודעה זו.", "emails.magicSession.footer": "אם לא ביקשת להיכנס באמצעות דוא\"ל זה, תוכל להתעלם מהודעה זו.",
"emails.magicSession.thanks": "תודה", "emails.magicSession.thanks": "תודה",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "धन्यवाद", "emails.verification.thanks": "धन्यवाद",
"emails.verification.signature": "{{project}} टीम", "emails.verification.signature": "{{project}} टीम",
"emails.magicSession.subject": "लॉग इन", "emails.magicSession.subject": "लॉग इन",
"emails.magicSession.hello": "नमस्ते,", "emails.magicSession.hello": "नमस्ते",
"emails.magicSession.body": "इस लिंक के माध्यम से लॉग-इन करें।", "emails.magicSession.body": "इस लिंक के माध्यम से लॉग-इन करें।",
"emails.magicSession.footer": "यदि आप इस ईमेल द्वारा लॉगिन नहीं करना चाहते हैं, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।", "emails.magicSession.footer": "यदि आप इस ईमेल द्वारा लॉगिन नहीं करना चाहते हैं, तो आप इस संदेश को नज़रअंदाज़ कर सकते हैं।",
"emails.magicSession.thanks": "धन्यवाद", "emails.magicSession.thanks": "धन्यवाद",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Hvala", "emails.verification.thanks": "Hvala",
"emails.verification.signature": "{{project}} tim", "emails.verification.signature": "{{project}} tim",
"emails.magicSession.subject": "Prijavite se", "emails.magicSession.subject": "Prijavite se",
"emails.magicSession.hello": "Pozdrav,", "emails.magicSession.hello": "Pozdrav",
"emails.magicSession.body": "Slijedite ovu poveznicu za prijavu.", "emails.magicSession.body": "Slijedite ovu poveznicu za prijavu.",
"emails.magicSession.footer": "Ako niste zatražili prijavu putem ove e-pošte, možete zanemariti ovu poruku.", "emails.magicSession.footer": "Ako niste zatražili prijavu putem ove e-pošte, možete zanemariti ovu poruku.",
"emails.magicSession.thanks": "Hvala", "emails.magicSession.thanks": "Hvala",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Köszönettel", "emails.verification.thanks": "Köszönettel",
"emails.verification.signature": "a {{project}} csapat", "emails.verification.signature": "a {{project}} csapat",
"emails.magicSession.subject": "Bejelentkezés", "emails.magicSession.subject": "Bejelentkezés",
"emails.magicSession.hello": "Szia,", "emails.magicSession.hello": "Szia",
"emails.magicSession.body": "Kattints a linkre a bejelentkezéshez.", "emails.magicSession.body": "Kattints a linkre a bejelentkezéshez.",
"emails.magicSession.footer": "Ha nem te szerettél volna bejelentkezni ezzel az email címmel, akkor nyugodtan hagyd figyelmen kívül ezt az üzenetet.", "emails.magicSession.footer": "Ha nem te szerettél volna bejelentkezni ezzel az email címmel, akkor nyugodtan hagyd figyelmen kívül ezt az üzenetet.",
"emails.magicSession.thanks": "Köszönettel", "emails.magicSession.thanks": "Köszönettel",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Terima kasih", "emails.verification.thanks": "Terima kasih",
"emails.verification.signature": "Tim {{project}}", "emails.verification.signature": "Tim {{project}}",
"emails.magicSession.subject": "Masuk", "emails.magicSession.subject": "Masuk",
"emails.magicSession.hello": "Hai,", "emails.magicSession.hello": "Hai",
"emails.magicSession.body": "Ikuti tautan ini untuk masuk.", "emails.magicSession.body": "Ikuti tautan ini untuk masuk.",
"emails.magicSession.footer": "Jika Anda tidak meminta untuk masuk menggunakan email ini, Anda dapat mengabaikan pesan ini.", "emails.magicSession.footer": "Jika Anda tidak meminta untuk masuk menggunakan email ini, Anda dapat mengabaikan pesan ini.",
"emails.magicSession.thanks": "Terima kasih", "emails.magicSession.thanks": "Terima kasih",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Grazie", "emails.verification.thanks": "Grazie",
"emails.verification.signature": "Il team {{project}}", "emails.verification.signature": "Il team {{project}}",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Ciao,", "emails.magicSession.hello": "Ciao",
"emails.magicSession.body": "Clicca questo link per accedere.", "emails.magicSession.body": "Clicca questo link per accedere.",
"emails.magicSession.footer": "Se non hai richiesto di effettuare laccesso, puoi ignorare questo messaggio.", "emails.magicSession.footer": "Se non hai richiesto di effettuare laccesso, puoi ignorare questo messaggio.",
"emails.magicSession.thanks": "Grazie", "emails.magicSession.thanks": "Grazie",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Matur nuwun", "emails.verification.thanks": "Matur nuwun",
"emails.verification.signature": "Tim {{project}}", "emails.verification.signature": "Tim {{project}}",
"emails.magicSession.subject": "Masuk", "emails.magicSession.subject": "Masuk",
"emails.magicSession.hello": "Hai,", "emails.magicSession.hello": "Hai",
"emails.magicSession.body": "Klik link iki kanggo masuk.", "emails.magicSession.body": "Klik link iki kanggo masuk.",
"emails.magicSession.footer": "Yen sampeyan ora njaluk masuk nggunakake alamat email iki, sampeyan iso nglirwakake pesen iki.", "emails.magicSession.footer": "Yen sampeyan ora njaluk masuk nggunakake alamat email iki, sampeyan iso nglirwakake pesen iki.",
"emails.magicSession.thanks": "Matur nuwun", "emails.magicSession.thanks": "Matur nuwun",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ಧನ್ಯವಾದಗಳು", "emails.verification.thanks": "ಧನ್ಯವಾದಗಳು",
"emails.verification.signature": "{{project}} ತಂಡ", "emails.verification.signature": "{{project}} ತಂಡ",
"emails.magicSession.subject": "ಲಾಗಿನ್", "emails.magicSession.subject": "ಲಾಗಿನ್",
"emails.magicSession.hello": "ನಮಸ್ಕಾರ,", "emails.magicSession.hello": "ನಮಸ್ಕಾರ",
"emails.magicSession.body": "ಲಾಗಿನ್ ಮಾಡಲಿಕ್ಕೆ ಈ ಲಿಂಕನ್ನು ಅನುಸರಿಸಿ", "emails.magicSession.body": "ಲಾಗಿನ್ ಮಾಡಲಿಕ್ಕೆ ಈ ಲಿಂಕನ್ನು ಅನುಸರಿಸಿ",
"emails.magicSession.footer": "ನೀವು ಈ ಇಮೇಲನಿಂದ ಲಾಗಿನ್ ಮಾಡಲು ಕೇಳದಿದ್ದರೆ, ಈ ಸಂದೇಶವನ್ನು ನಿರ್ಲಕ್ಷಿಸಿ", "emails.magicSession.footer": "ನೀವು ಈ ಇಮೇಲನಿಂದ ಲಾಗಿನ್ ಮಾಡಲು ಕೇಳದಿದ್ದರೆ, ಈ ಸಂದೇಶವನ್ನು ನಿರ್ಲಕ್ಷಿಸಿ",
"emails.magicSession.thanks": "ಧನ್ಯವಾದಗಳು", "emails.magicSession.thanks": "ಧನ್ಯವಾದಗಳು",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "감사합니다", "emails.verification.thanks": "감사합니다",
"emails.verification.signature": "{{project}} 팀", "emails.verification.signature": "{{project}} 팀",
"emails.magicSession.subject": "로그인", "emails.magicSession.subject": "로그인",
"emails.magicSession.hello": "안녕하세요,", "emails.magicSession.hello": "안녕하세요",
"emails.magicSession.body": "로그인 하시려면 링크를 클릭하여주세요.", "emails.magicSession.body": "로그인 하시려면 링크를 클릭하여주세요.",
"emails.magicSession.footer": "이 이메일 계정으로 로그인 신청을 하지 않으셨다면 이 메세지를 무시하여주세요.", "emails.magicSession.footer": "이 이메일 계정으로 로그인 신청을 하지 않으셨다면 이 메세지를 무시하여주세요.",
"emails.magicSession.thanks": "감사합니다", "emails.magicSession.thanks": "감사합니다",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Gratias", "emails.verification.thanks": "Gratias",
"emails.verification.signature": "{{project}} Team", "emails.verification.signature": "{{project}} Team",
"emails.magicSession.subject": "Log in", "emails.magicSession.subject": "Log in",
"emails.magicSession.hello": "Salve ibi,", "emails.magicSession.hello": "Salve ibi",
"emails.magicSession.body": "Hanc nexum cum login", "emails.magicSession.body": "Hanc nexum cum login",
"emails.magicSession.footer": "Si verificationem huius inscriptionis non postulasti, nuntium hunc ignorare potes.", "emails.magicSession.footer": "Si verificationem huius inscriptionis non postulasti, nuntium hunc ignorare potes.",
"emails.magicSession.thanks": "Gratias", "emails.magicSession.thanks": "Gratias",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Merci", "emails.verification.thanks": "Merci",
"emails.verification.signature": "{{project}} équipe", "emails.verification.signature": "{{project}} équipe",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Hey,", "emails.magicSession.hello": "Hey",
"emails.magicSession.body": "Follegt dëse Link fir umellen.", "emails.magicSession.body": "Follegt dëse Link fir umellen.",
"emails.magicSession.footer": "Wann Dir net gefrot hutt Iech mat dëser E -Mail anzemelden, kënnt Dir dëse Message ignoréieren.", "emails.magicSession.footer": "Wann Dir net gefrot hutt Iech mat dëser E -Mail anzemelden, kënnt Dir dëse Message ignoréieren.",
"emails.magicSession.thanks": "Merci", "emails.magicSession.thanks": "Merci",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Ačiū", "emails.verification.thanks": "Ačiū",
"emails.verification.signature": "{{project}} komanda", "emails.verification.signature": "{{project}} komanda",
"emails.magicSession.subject": "Prisijungti", "emails.magicSession.subject": "Prisijungti",
"emails.magicSession.hello": "Labas,", "emails.magicSession.hello": "Labas",
"emails.magicSession.body": "Spauskite šią nuorodą, kad prisijungtumėte.", "emails.magicSession.body": "Spauskite šią nuorodą, kad prisijungtumėte.",
"emails.magicSession.footer": "Jei neprašėte prisijungti naudojantis šiuo el. paštu, galite ignoruoti šį pranešimą.", "emails.magicSession.footer": "Jei neprašėte prisijungti naudojantis šiuo el. paštu, galite ignoruoti šį pranešimą.",
"emails.magicSession.thanks": "Ačiū", "emails.magicSession.thanks": "Ačiū",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Paldies", "emails.verification.thanks": "Paldies",
"emails.verification.signature": "{{project}} komanda", "emails.verification.signature": "{{project}} komanda",
"emails.magicSession.subject": "Ieiet", "emails.magicSession.subject": "Ieiet",
"emails.magicSession.hello": "Sveicināti,", "emails.magicSession.hello": "Sveicināti",
"emails.magicSession.body": "Sekojiet saitei, lai ieietu.", "emails.magicSession.body": "Sekojiet saitei, lai ieietu.",
"emails.magicSession.footer": "Ja Jūs nepieprasījāt ieiet ar šo e-pasta adresi, lūdzu, ignorējiet šo ziņu.", "emails.magicSession.footer": "Ja Jūs nepieprasījāt ieiet ar šo e-pasta adresi, lūdzu, ignorējiet šo ziņu.",
"emails.magicSession.thanks": "Paldies", "emails.magicSession.thanks": "Paldies",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "നന്ദി", "emails.verification.thanks": "നന്ദി",
"emails.verification.signature": "{{project}} ടീം", "emails.verification.signature": "{{project}} ടീം",
"emails.magicSession.subject": "ലോഗിൻ", "emails.magicSession.subject": "ലോഗിൻ",
"emails.magicSession.hello": "നമസ്കാരം,", "emails.magicSession.hello": "നമസ്കാരം",
"emails.magicSession.body": "ലോഗിൻ ചെയ്യുന്നതിനായി ഈ ലിങ്ക് പിന്തുടരുക.", "emails.magicSession.body": "ലോഗിൻ ചെയ്യുന്നതിനായി ഈ ലിങ്ക് പിന്തുടരുക.",
"emails.magicSession.footer": "ഈ ഇമെയിൽ ഉപയോഗിച്ച് ലോഗിൻ ചെയ്യാൻ നിങ്ങൾ ആവശ്യപ്പെട്ടില്ലെങ്കിൽ, ഈ സന്ദേശം അവഗണിക്കാവുന്നതാണ്.", "emails.magicSession.footer": "ഈ ഇമെയിൽ ഉപയോഗിച്ച് ലോഗിൻ ചെയ്യാൻ നിങ്ങൾ ആവശ്യപ്പെട്ടില്ലെങ്കിൽ, ഈ സന്ദേശം അവഗണിക്കാവുന്നതാണ്.",
"emails.magicSession.thanks": "നന്ദി", "emails.magicSession.thanks": "നന്ദി",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "धन्यवाद", "emails.verification.thanks": "धन्यवाद",
"emails.verification.signature": "{{project}} संघ", "emails.verification.signature": "{{project}} संघ",
"emails.magicSession.subject": "लॉगिन करा", "emails.magicSession.subject": "लॉगिन करा",
"emails.magicSession.hello": "नमस्कार ,", "emails.magicSession.hello": "नमस्कार ",
"emails.magicSession.body": "लॉगिन करण्यासाठी या लिंकचे अनुसरण करा.", "emails.magicSession.body": "लॉगिन करण्यासाठी या लिंकचे अनुसरण करा.",
"emails.magicSession.footer": "आपण या ईमेलचा वापर करून लॉगिन करण्यास सांगितले नसल्यास, आपण या संदेशाकडे दुर्लक्ष करू शकता.", "emails.magicSession.footer": "आपण या ईमेलचा वापर करून लॉगिन करण्यास सांगितले नसल्यास, आपण या संदेशाकडे दुर्लक्ष करू शकता.",
"emails.magicSession.thanks": "धन्यवाद", "emails.magicSession.thanks": "धन्यवाद",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Terima kasih", "emails.verification.thanks": "Terima kasih",
"emails.verification.signature": "{{project}} team", "emails.verification.signature": "{{project}} team",
"emails.magicSession.subject": "Log masuk", "emails.magicSession.subject": "Log masuk",
"emails.magicSession.hello": "Hey,", "emails.magicSession.hello": "Hey",
"emails.magicSession.body": "Tekan pautan ini untuk log masuk.", "emails.magicSession.body": "Tekan pautan ini untuk log masuk.",
"emails.magicSession.footer": "Sekiranya anda tidak membuat permintaan untuk log masuk menggunakan email ini, sila abaikan mesej ini.", "emails.magicSession.footer": "Sekiranya anda tidak membuat permintaan untuk log masuk menggunakan email ini, sila abaikan mesej ini.",
"emails.magicSession.thanks": "Terima kasih", "emails.magicSession.thanks": "Terima kasih",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Takk", "emails.verification.thanks": "Takk",
"emails.verification.signature": "{{project}} team", "emails.verification.signature": "{{project}} team",
"emails.magicSession.subject": "Pålogging", "emails.magicSession.subject": "Pålogging",
"emails.magicSession.hello": "Hei,", "emails.magicSession.hello": "Hei",
"emails.magicSession.body": "Følg denne lenken for å logge på.", "emails.magicSession.body": "Følg denne lenken for å logge på.",
"emails.magicSession.footer": "Dersom du ikke ba om å logge på med denne e-postadressen, kan du se bort fra denne meldingen.", "emails.magicSession.footer": "Dersom du ikke ba om å logge på med denne e-postadressen, kan du se bort fra denne meldingen.",
"emails.magicSession.thanks": "Takk", "emails.magicSession.thanks": "Takk",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "धन्यवाद", "emails.verification.thanks": "धन्यवाद",
"emails.verification.signature": "{{project}} समूह", "emails.verification.signature": "{{project}} समूह",
"emails.magicSession.subject": "लगइन", "emails.magicSession.subject": "लगइन",
"emails.magicSession.hello": "नमस्ते,", "emails.magicSession.hello": "नमस्ते",
"emails.magicSession.body": "लगइन गर्नको लागी यो लिंकमा जानुहोस।", "emails.magicSession.body": "लगइन गर्नको लागी यो लिंकमा जानुहोस।",
"emails.magicSession.footer": "यदि तपाइँले यो इमेल प्रयोग गरेर लगइन गर्न सोध्नु भएको छैन भने तपाइँले यो सन्देश लाई बेवास्ता गर्न सक्नुहुन्छ।", "emails.magicSession.footer": "यदि तपाइँले यो इमेल प्रयोग गरेर लगइन गर्न सोध्नु भएको छैन भने तपाइँले यो सन्देश लाई बेवास्ता गर्न सक्नुहुन्छ।",
"emails.magicSession.thanks": "धन्यवाद", "emails.magicSession.thanks": "धन्यवाद",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Bedankt", "emails.verification.thanks": "Bedankt",
"emails.verification.signature": "{{project}} team", "emails.verification.signature": "{{project}} team",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Hoi,", "emails.magicSession.hello": "Hoi",
"emails.magicSession.body": "Volg deze link om in te loggen", "emails.magicSession.body": "Volg deze link om in te loggen",
"emails.magicSession.footer": "Als u geen aanvraag heeft gemaakt om met deze mail in te loggen, kan u deze mail negeren", "emails.magicSession.footer": "Als u geen aanvraag heeft gemaakt om met deze mail in te loggen, kan u deze mail negeren",
"emails.magicSession.thanks": "Bedankt", "emails.magicSession.thanks": "Bedankt",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Takk", "emails.verification.thanks": "Takk",
"emails.verification.signature": "{{project}} team", "emails.verification.signature": "{{project}} team",
"emails.magicSession.subject": "Pålogging", "emails.magicSession.subject": "Pålogging",
"emails.magicSession.hello": "Hei,", "emails.magicSession.hello": "Hei",
"emails.magicSession.body": "Følg denne lenkja for å logge på.", "emails.magicSession.body": "Følg denne lenkja for å logge på.",
"emails.magicSession.footer": "Om du ikkje ba om å logge på med denne e-postadressa, kan du ignorera denne meldinga.", "emails.magicSession.footer": "Om du ikkje ba om å logge på med denne e-postadressa, kan du ignorera denne meldinga.",
"emails.magicSession.thanks": "Takk", "emails.magicSession.thanks": "Takk",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ଧନ୍ୟବାଦ", "emails.verification.thanks": "ଧନ୍ୟବାଦ",
"emails.verification.signature": "{{project}} ଦଳ", "emails.verification.signature": "{{project}} ଦଳ",
"emails.magicSession.subject": "ଲଗଇନ୍ କରନ୍ତୁ", "emails.magicSession.subject": "ଲଗଇନ୍ କରନ୍ତୁ",
"emails.magicSession.hello": "ନମସ୍କାର,", "emails.magicSession.hello": "ନମସ୍କାର",
"emails.magicSession.body": "ଲଗଇନ୍ କରିବାକୁ ଏହି ଲିଙ୍କ୍ ଅନୁସରଣ କରନ୍ତୁ |", "emails.magicSession.body": "ଲଗଇନ୍ କରିବାକୁ ଏହି ଲିଙ୍କ୍ ଅନୁସରଣ କରନ୍ତୁ |",
"emails.magicSession.footer": "ଯଦି ଆପଣ ଏହି ଇମେଲ୍ ବ୍ୟବହାର କରି ଲଗଇନ୍ କରିବାକୁ କହି ନାହାଁନ୍ତି, ତେବେ ଆପଣ ଏହି ସନ୍ଦେଶକୁ ଉପେକ୍ଷା କରିପାରିବେ |", "emails.magicSession.footer": "ଯଦି ଆପଣ ଏହି ଇମେଲ୍ ବ୍ୟବହାର କରି ଲଗଇନ୍ କରିବାକୁ କହି ନାହାଁନ୍ତି, ତେବେ ଆପଣ ଏହି ସନ୍ଦେଶକୁ ଉପେକ୍ଷା କରିପାରିବେ |",
"emails.magicSession.thanks": "ଧନ୍ୟବାଦ", "emails.magicSession.thanks": "ଧନ୍ୟବାଦ",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Dziękujemy", "emails.verification.thanks": "Dziękujemy",
"emails.verification.signature": "Zespół {{project}}", "emails.verification.signature": "Zespół {{project}}",
"emails.magicSession.subject": "Logowanie", "emails.magicSession.subject": "Logowanie",
"emails.magicSession.hello": "Cześć,", "emails.magicSession.hello": "Cześć",
"emails.magicSession.body": "Kliknij w ten link, aby zalogować się.", "emails.magicSession.body": "Kliknij w ten link, aby zalogować się.",
"emails.magicSession.footer": "Jeśli to nie Ty prosiłeś o logowanie przy użyciu tego adresu e-mail, zignoruj tę wiadomość.", "emails.magicSession.footer": "Jeśli to nie Ty prosiłeś o logowanie przy użyciu tego adresu e-mail, zignoruj tę wiadomość.",
"emails.magicSession.thanks": "Dziękujemy", "emails.magicSession.thanks": "Dziękujemy",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Muito obrigado", "emails.verification.thanks": "Muito obrigado",
"emails.verification.signature": "Time {{project}}", "emails.verification.signature": "Time {{project}}",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Olá,", "emails.magicSession.hello": "Olá",
"emails.magicSession.body": "Clique neste link para entrar.", "emails.magicSession.body": "Clique neste link para entrar.",
"emails.magicSession.footer": "Se você não solicitou conectar-se com este e-mail, ignore essa mensagem.", "emails.magicSession.footer": "Se você não solicitou conectar-se com este e-mail, ignore essa mensagem.",
"emails.magicSession.thanks": "Muito obrigado", "emails.magicSession.thanks": "Muito obrigado",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Obrigado", "emails.verification.thanks": "Obrigado",
"emails.verification.signature": "Equipa {{project}}", "emails.verification.signature": "Equipa {{project}}",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Olá ,", "emails.magicSession.hello": "Olá ",
"emails.magicSession.body": "Siga esta ligação para iniciar sessão.", "emails.magicSession.body": "Siga esta ligação para iniciar sessão.",
"emails.magicSession.footer": "Se não pediu para entrar usando este e-mail, pode ignorar esta mensagem.", "emails.magicSession.footer": "Se não pediu para entrar usando este e-mail, pode ignorar esta mensagem.",
"emails.magicSession.thanks": "Obrigado", "emails.magicSession.thanks": "Obrigado",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Mulțumim", "emails.verification.thanks": "Mulțumim",
"emails.verification.signature": "Echipa {{project}}", "emails.verification.signature": "Echipa {{project}}",
"emails.magicSession.subject": "Login", "emails.magicSession.subject": "Login",
"emails.magicSession.hello": "Bună ziua,", "emails.magicSession.hello": "Bună ziua",
"emails.magicSession.body": "Urmează acest link pentru logare.", "emails.magicSession.body": "Urmează acest link pentru logare.",
"emails.magicSession.footer": "Dacă nu ai incercat să te loghezi folosing această adresa de email, poți ignora acest mesaj.", "emails.magicSession.footer": "Dacă nu ai incercat să te loghezi folosing această adresa de email, poți ignora acest mesaj.",
"emails.magicSession.thanks": "Mulțumim", "emails.magicSession.thanks": "Mulțumim",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Спасибо", "emails.verification.thanks": "Спасибо",
"emails.verification.signature": "команда {{project}}", "emails.verification.signature": "команда {{project}}",
"emails.magicSession.subject": "Логин", "emails.magicSession.subject": "Логин",
"emails.magicSession.hello": "Здравствуйте,", "emails.magicSession.hello": "Здравствуйте",
"emails.magicSession.body": "Перейдите по ссылке, чтобы войти.", "emails.magicSession.body": "Перейдите по ссылке, чтобы войти.",
"emails.magicSession.footer": "Если вы не просили войти, используя этот адрес электронной почты, проигнорируйте это сообщение.", "emails.magicSession.footer": "Если вы не просили войти, используя этот адрес электронной почты, проигнорируйте это сообщение.",
"emails.magicSession.thanks": "Спасибо", "emails.magicSession.thanks": "Спасибо",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "धन्यवादः", "emails.verification.thanks": "धन्यवादः",
"emails.verification.signature": "{{project}} गणः", "emails.verification.signature": "{{project}} गणः",
"emails.magicSession.subject": "संप्रवेशः", "emails.magicSession.subject": "संप्रवेशः",
"emails.magicSession.hello": "अयि,", "emails.magicSession.hello": "अयि",
"emails.magicSession.body": "संप्रवेशार्थमिदं संयोगसूत्रमनुसरतु।", "emails.magicSession.body": "संप्रवेशार्थमिदं संयोगसूत्रमनुसरतु।",
"emails.magicSession.footer": "अनेन ई-पत्रण यदि संप्रवेशो नेष्यते तर्हि वात्र्तामिमामुपेक्षताम्‌।", "emails.magicSession.footer": "अनेन ई-पत्रण यदि संप्रवेशो नेष्यते तर्हि वात्र्तामिमामुपेक्षताम्‌।",
"emails.magicSession.thanks": "धन्यवादः", "emails.magicSession.thanks": "धन्यवादः",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ස්තුතියි", "emails.verification.thanks": "ස්තුතියි",
"emails.verification.signature": "{{project}} කණ්ඩායම", "emails.verification.signature": "{{project}} කණ්ඩායම",
"emails.magicSession.subject": "ප්‍රවේශ වන්න", "emails.magicSession.subject": "ප්‍රවේශ වන්න",
"emails.magicSession.hello": "හේයි,", "emails.magicSession.hello": "හේයි",
"emails.magicSession.body": "ප්‍රවේශ වීමට මෙම සම්බන්ධකය අනුගමනය කරන්න.", "emails.magicSession.body": "ප්‍රවේශ වීමට මෙම සම්බන්ධකය අනුගමනය කරන්න.",
"emails.magicSession.footer": "මෙම විද්‍යුත් තැපෑල භාවිතයෙන් ප්‍රවේශ වීමට ඔබ ඉල්ලුවේ නැත්නම්, ඔබට මෙම පණිවිඩය නොසලකා හැරිය හැක.", "emails.magicSession.footer": "මෙම විද්‍යුත් තැපෑල භාවිතයෙන් ප්‍රවේශ වීමට ඔබ ඉල්ලුවේ නැත්නම්, ඔබට මෙම පණිවිඩය නොසලකා හැරිය හැක.",
"emails.magicSession.thanks": "ස්තුතියි", "emails.magicSession.thanks": "ස්තුතියි",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Ďakujeme.", "emails.verification.thanks": "Ďakujeme.",
"emails.verification.signature": "{{project}} tím", "emails.verification.signature": "{{project}} tím",
"emails.magicSession.subject": "Prihlásenie", "emails.magicSession.subject": "Prihlásenie",
"emails.magicSession.hello": "Ahoj,", "emails.magicSession.hello": "Ahoj",
"emails.magicSession.body": "Použi tento link pre prihlásenie.", "emails.magicSession.body": "Použi tento link pre prihlásenie.",
"emails.magicSession.footer": "Ak si nepožiadal o prihlásenie cez email, túto správu môžeš ignorovať.", "emails.magicSession.footer": "Ak si nepožiadal o prihlásenie cez email, túto správu môžeš ignorovať.",
"emails.magicSession.thanks": "Ďakujeme", "emails.magicSession.thanks": "Ďakujeme",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Ndatenda", "emails.verification.thanks": "Ndatenda",
"emails.verification.signature": "Chikwata che{{project}}", "emails.verification.signature": "Chikwata che{{project}}",
"emails.magicSession.subject": "Pinda", "emails.magicSession.subject": "Pinda",
"emails.magicSession.hello": "Hesi,", "emails.magicSession.hello": "Hesi",
"emails.magicSession.body": "Baya chinongedzo ichi kuti upinde muakaundi yako.", "emails.magicSession.body": "Baya chinongedzo ichi kuti upinde muakaundi yako.",
"emails.magicSession.footer": "Kana usina kukumbira kupinda muakaundi yako uchishandisa email iyi, unogona kufuratira meseji iyi.", "emails.magicSession.footer": "Kana usina kukumbira kupinda muakaundi yako uchishandisa email iyi, unogona kufuratira meseji iyi.",
"emails.magicSession.thanks": "Ndatenda", "emails.magicSession.thanks": "Ndatenda",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Tack", "emails.verification.thanks": "Tack",
"emails.verification.signature": "{{project}} teamet", "emails.verification.signature": "{{project}} teamet",
"emails.magicSession.subject": "Logga in", "emails.magicSession.subject": "Logga in",
"emails.magicSession.hello": "Hej,", "emails.magicSession.hello": "Hej",
"emails.magicSession.body": "Klicka på denna länk för att logga in.", "emails.magicSession.body": "Klicka på denna länk för att logga in.",
"emails.magicSession.footer": "Om du inte bad om att logga in med denna e-postadress kan du ignorera detta mail.", "emails.magicSession.footer": "Om du inte bad om att logga in med denna e-postadress kan du ignorera detta mail.",
"emails.magicSession.thanks": "Tack", "emails.magicSession.thanks": "Tack",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "நன்றி", "emails.verification.thanks": "நன்றி",
"emails.verification.signature": "{{project}} குழு ", "emails.verification.signature": "{{project}} குழு ",
"emails.magicSession.subject": "உள்நுழைய", "emails.magicSession.subject": "உள்நுழைய",
"emails.magicSession.hello": "ஏய்,", "emails.magicSession.hello": "ஏய்",
"emails.magicSession.body": "இந்த இணைப்பைப் பின்தொடரவும் உள்நுழைய", "emails.magicSession.body": "இந்த இணைப்பைப் பின்தொடரவும் உள்நுழைய",
"emails.magicSession.footer": "இந்த மின்னஞ்சலைப் பயன்படுத்தி உள்நுழையுமாறு உங்களிடம் கேட்கப்படாவிட்டால், இந்தச் செய்தியைப் புறக்கணிக்கலாம்.", "emails.magicSession.footer": "இந்த மின்னஞ்சலைப் பயன்படுத்தி உள்நுழையுமாறு உங்களிடம் கேட்கப்படாவிட்டால், இந்தச் செய்தியைப் புறக்கணிக்கலாம்.",
"emails.magicSession.thanks": "நன்றி", "emails.magicSession.thanks": "நன்றி",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ధన్యవాదాలు", "emails.verification.thanks": "ధన్యవాదాలు",
"emails.verification.signature": "{{project}} జట్", "emails.verification.signature": "{{project}} జట్",
"emails.magicSession.subject": "లాగిన్", "emails.magicSession.subject": "లాగిన్",
"emails.magicSession.hello": "నమస్కారము,", "emails.magicSession.hello": "నమస్కారము",
"emails.magicSession.body": "లాగిన్ చేయడానికి ఈ లింక్ ని అనుసరించండి", "emails.magicSession.body": "లాగిన్ చేయడానికి ఈ లింక్ ని అనుసరించండి",
"emails.magicSession.footer": "మీరు ఈ ఇమెయిల్ ని ఉపయోగించి లాగిన్ చేయమని అడగకపోతే, మీరు ఈ సందేశాన్ని విస్మరించవచ్చు", "emails.magicSession.footer": "మీరు ఈ ఇమెయిల్ ని ఉపయోగించి లాగిన్ చేయమని అడగకపోతే, మీరు ఈ సందేశాన్ని విస్మరించవచ్చు",
"emails.magicSession.thanks": "ధన్యవాదాలు", "emails.magicSession.thanks": "ధన్యవాదాలు",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "ขอบคุณ", "emails.verification.thanks": "ขอบคุณ",
"emails.verification.signature": "ทีม {{project}}", "emails.verification.signature": "ทีม {{project}}",
"emails.magicSession.subject": "เข้าสู่ระบบ", "emails.magicSession.subject": "เข้าสู่ระบบ",
"emails.magicSession.hello": "เรียนผู้ใช้งาน,", "emails.magicSession.hello": "เรียนผู้ใช้งาน",
"emails.magicSession.body": "กดเข้าไปที่ลิงก์นี้เพื่อเข้าสู่ระบบ", "emails.magicSession.body": "กดเข้าไปที่ลิงก์นี้เพื่อเข้าสู่ระบบ",
"emails.magicSession.footer": "หากท่านไม่ได้ต้องการที่จะเข้าสู่ระบบด้วยอีเมลนี้ ท่านสามารถเพิกเฉยข้อความนี้ได้", "emails.magicSession.footer": "หากท่านไม่ได้ต้องการที่จะเข้าสู่ระบบด้วยอีเมลนี้ ท่านสามารถเพิกเฉยข้อความนี้ได้",
"emails.magicSession.thanks": "ขอบคุณ", "emails.magicSession.thanks": "ขอบคุณ",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Salamat", "emails.verification.thanks": "Salamat",
"emails.verification.signature": "Pangkat ng {{project}}", "emails.verification.signature": "Pangkat ng {{project}}",
"emails.magicSession.subject": "Mag log in", "emails.magicSession.subject": "Mag log in",
"emails.magicSession.hello": "Kamusta, ", "emails.magicSession.hello": "Kamusta ",
"emails.magicSession.body": "Sundin ang link na ito upang mag-login.", "emails.magicSession.body": "Sundin ang link na ito upang mag-login.",
"emails.magicSession.footer": "Kung hindi mo hiningi na mag-login gamit ang email na ito, maaari mong balewalain ang mensahe na ito.", "emails.magicSession.footer": "Kung hindi mo hiningi na mag-login gamit ang email na ito, maaari mong balewalain ang mensahe na ito.",
"emails.magicSession.thanks": "Salamat", "emails.magicSession.thanks": "Salamat",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Teşekkürler", "emails.verification.thanks": "Teşekkürler",
"emails.verification.signature": "{{project}} takımı", "emails.verification.signature": "{{project}} takımı",
"emails.magicSession.subject": "Giriş", "emails.magicSession.subject": "Giriş",
"emails.magicSession.hello": "Merhaba,", "emails.magicSession.hello": "Merhaba",
"emails.magicSession.body": "Giriş yapmak için tıklayın.", "emails.magicSession.body": "Giriş yapmak için tıklayın.",
"emails.magicSession.footer": "Eğer bu eposta adresini kullanarak giriş yapmak istemediyseniz devam etmeyin.", "emails.magicSession.footer": "Eğer bu eposta adresini kullanarak giriş yapmak istemediyseniz devam etmeyin.",
"emails.magicSession.thanks": "Teşekkürler", "emails.magicSession.thanks": "Teşekkürler",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Дякуємо", "emails.verification.thanks": "Дякуємо",
"emails.verification.signature": "команда {{project}}", "emails.verification.signature": "команда {{project}}",
"emails.magicSession.subject": "Логін", "emails.magicSession.subject": "Логін",
"emails.magicSession.hello": "Вітаємо,", "emails.magicSession.hello": "Вітаємо",
"emails.magicSession.body": "Перейдіть за цим посиланням, щоб увійти.", "emails.magicSession.body": "Перейдіть за цим посиланням, щоб увійти.",
"emails.magicSession.footer": "Якщо ви не просили увійти за допомогою цієї електронної пошти, ви можете ігнорувати це повідомлення.", "emails.magicSession.footer": "Якщо ви не просили увійти за допомогою цієї електронної пошти, ви можете ігнорувати це повідомлення.",
"emails.magicSession.thanks": "Дякуємо", "emails.magicSession.thanks": "Дякуємо",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "شکریہ", "emails.verification.thanks": "شکریہ",
"emails.verification.signature": "ٹیم۔ {{project}}", "emails.verification.signature": "ٹیم۔ {{project}}",
"emails.magicSession.subject": "اگ ان کریں", "emails.magicSession.subject": "اگ ان کریں",
"emails.magicSession.hello": "خوش آمدید,", "emails.magicSession.hello": "خوش آمدید",
"emails.magicSession.body": "لاگ ان کرنے کے لیے اس لنک پر عمل کریں۔", "emails.magicSession.body": "لاگ ان کرنے کے لیے اس لنک پر عمل کریں۔",
"emails.magicSession.footer": "اگر آپ نے اس ای میل کا استعمال کرتے ہوئے لاگ ان کرنے کے لیے نہیں کہا تو آپ اس پیغام کو نظر انداز کر سکتے ہیں۔", "emails.magicSession.footer": "اگر آپ نے اس ای میل کا استعمال کرتے ہوئے لاگ ان کرنے کے لیے نہیں کہا تو آپ اس پیغام کو نظر انداز کر سکتے ہیں۔",
"emails.magicSession.thanks": "شکریہ", "emails.magicSession.thanks": "شکریہ",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "Cảm ơn", "emails.verification.thanks": "Cảm ơn",
"emails.verification.signature": "Nhóm {{project}}", "emails.verification.signature": "Nhóm {{project}}",
"emails.magicSession.subject": "Đăng nhập", "emails.magicSession.subject": "Đăng nhập",
"emails.magicSession.hello": "Chào,", "emails.magicSession.hello": "Chào",
"emails.magicSession.body": "Nhấn vào đường dẫn sau để đăng nhập.", "emails.magicSession.body": "Nhấn vào đường dẫn sau để đăng nhập.",
"emails.magicSession.footer": "Nếu bạn không yêu cầu đăng nhập bằng email, bạn có thể bỏ qua email này.", "emails.magicSession.footer": "Nếu bạn không yêu cầu đăng nhập bằng email, bạn có thể bỏ qua email này.",
"emails.magicSession.thanks": "Cảm ơn", "emails.magicSession.thanks": "Cảm ơn",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "谢谢", "emails.verification.thanks": "谢谢",
"emails.verification.signature": "{{project}} 团队", "emails.verification.signature": "{{project}} 团队",
"emails.magicSession.subject": "登录", "emails.magicSession.subject": "登录",
"emails.magicSession.hello": "你好,", "emails.magicSession.hello": "你好",
"emails.magicSession.body": "点此链接登录。", "emails.magicSession.body": "点此链接登录。",
"emails.magicSession.footer": "如果您没有要求使用此电子邮件登录,则可忽略此消息。", "emails.magicSession.footer": "如果您没有要求使用此电子邮件登录,则可忽略此消息。",
"emails.magicSession.thanks": "谢谢", "emails.magicSession.thanks": "谢谢",

View file

@ -10,7 +10,7 @@
"emails.verification.thanks": "謝謝", "emails.verification.thanks": "謝謝",
"emails.verification.signature": "{{project}} 團隊", "emails.verification.signature": "{{project}} 團隊",
"emails.magicSession.subject": "登入", "emails.magicSession.subject": "登入",
"emails.magicSession.hello": "嗨", "emails.magicSession.hello": "嗨",
"emails.magicSession.body": "點此連結登入。", "emails.magicSession.body": "點此連結登入。",
"emails.magicSession.footer": "如果您沒有要求使用此電子郵件登入,則可以忽略此消息。", "emails.magicSession.footer": "如果您沒有要求使用此電子郵件登入,則可以忽略此消息。",
"emails.magicSession.thanks": "謝謝", "emails.magicSession.thanks": "謝謝",

View file

@ -5,11 +5,11 @@
*/ */
use Appwrite\Runtimes\Runtimes; use Appwrite\Runtimes\Runtimes;
use Utopia\App; use Utopia\System\System;
$runtimes = new Runtimes('v2'); $runtimes = new Runtimes('v2');
$allowList = empty(App::getEnv('_APP_FUNCTIONS_RUNTIMES')) ? [] : \explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES')); $allowList = empty(System::getEnv('_APP_FUNCTIONS_RUNTIMES')) ? [] : \explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES'));
$runtimes = $runtimes->getAll(true, $allowList); $runtimes = $runtimes->getAll(true, $allowList);

View file

@ -46,6 +46,7 @@ use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID; use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale; use Utopia\Locale\Locale;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Assoc; use Utopia\Validator\Assoc;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
@ -1012,7 +1013,7 @@ App::get('/v1/account/sessions/oauth2/:provider')
$appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}'; $appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}';
if (!empty($appSecret) && isset($appSecret['version'])) { if (!empty($appSecret) && isset($appSecret['version'])) {
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']); $key = System::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']);
$appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag'])); $appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag']));
} }
@ -1210,7 +1211,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
} }
if (!empty($appSecret) && isset($appSecret['version'])) { if (!empty($appSecret) && isset($appSecret['version'])) {
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']); $key = System::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']);
$appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag'])); $appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag']));
} }
@ -1594,7 +1595,7 @@ App::get('/v1/account/tokens/oauth2/:provider')
$appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}'; $appSecret = $project->getAttribute('oAuthProviders', [])[$provider . 'Secret'] ?? '{}';
if (!empty($appSecret) && isset($appSecret['version'])) { if (!empty($appSecret) && isset($appSecret['version'])) {
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']); $key = System::getEnv('_APP_OPENSSL_KEY_V' . $appSecret['version']);
$appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag'])); $appSecret = OpenSSL::decrypt($appSecret['data'], $appSecret['method'], $key, 0, \hex2bin($appSecret['iv']), \hex2bin($appSecret['tag']));
} }
@ -1660,7 +1661,7 @@ App::post('/v1/account/tokens/magic-url')
->inject('queueForMails') ->inject('queueForMails')
->action(function (string $userId, string $email, string $url, bool $phrase, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) { ->action(function (string $userId, string $email, string $url, bool $phrase, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) {
if (empty(App::getEnv('_APP_SMTP_HOST'))) { if (empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled'); throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled');
} }
@ -1788,8 +1789,8 @@ App::post('/v1/account/tokens/magic-url')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {
@ -1901,7 +1902,7 @@ App::post('/v1/account/tokens/email')
->inject('queueForEvents') ->inject('queueForEvents')
->inject('queueForMails') ->inject('queueForMails')
->action(function (string $userId, string $email, bool $phrase, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) { ->action(function (string $userId, string $email, bool $phrase, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) {
if (empty(App::getEnv('_APP_SMTP_HOST'))) { if (empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled'); throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled');
} }
@ -2017,8 +2018,8 @@ App::post('/v1/account/tokens/email')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {
@ -2190,7 +2191,7 @@ App::post('/v1/account/tokens/phone')
->inject('queueForMessaging') ->inject('queueForMessaging')
->inject('locale') ->inject('locale')
->action(function (string $userId, string $phone, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Event $queueForEvents, Messaging $queueForMessaging, Locale $locale) { ->action(function (string $userId, string $phone, Request $request, Response $response, Document $user, Document $project, Database $dbForProject, Event $queueForEvents, Messaging $queueForMessaging, Locale $locale) {
if (empty(App::getEnv('_APP_SMS_PROVIDER'))) { if (empty(System::getEnv('_APP_SMS_PROVIDER'))) {
throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured'); throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured');
} }
@ -2364,7 +2365,7 @@ App::post('/v1/account/jwt')
throw new Exception(Exception::USER_SESSION_NOT_FOUND); throw new Exception(Exception::USER_SESSION_NOT_FOUND);
} }
$jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway.
$response $response
->setStatusCode(Response::STATUS_CODE_CREATED) ->setStatusCode(Response::STATUS_CODE_CREATED)
@ -2845,7 +2846,7 @@ App::post('/v1/account/recovery')
->inject('queueForEvents') ->inject('queueForEvents')
->action(function (string $email, string $url, Request $request, Response $response, Document $user, Database $dbForProject, Document $project, Locale $locale, Mail $queueForMails, Event $queueForEvents) { ->action(function (string $email, string $url, Request $request, Response $response, Document $user, Database $dbForProject, Document $project, Locale $locale, Mail $queueForMails, Event $queueForEvents) {
if (empty(App::getEnv('_APP_SMTP_HOST'))) { if (empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP Disabled'); throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP Disabled');
} }
@ -2915,8 +2916,8 @@ App::post('/v1/account/recovery')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {
@ -3106,7 +3107,7 @@ App::post('/v1/account/verification')
->inject('queueForMails') ->inject('queueForMails')
->action(function (string $url, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) { ->action(function (string $url, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Locale $locale, Event $queueForEvents, Mail $queueForMails) {
if (empty(App::getEnv('_APP_SMTP_HOST'))) { if (empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP Disabled'); throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP Disabled');
} }
@ -3163,8 +3164,8 @@ App::post('/v1/account/verification')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {
@ -3326,7 +3327,7 @@ App::post('/v1/account/verification/phone')
->inject('project') ->inject('project')
->inject('locale') ->inject('locale')
->action(function (Request $request, Response $response, Document $user, Database $dbForProject, Event $queueForEvents, Messaging $queueForMessaging, Document $project, Locale $locale) { ->action(function (Request $request, Response $response, Document $user, Database $dbForProject, Event $queueForEvents, Messaging $queueForMessaging, Document $project, Locale $locale) {
if (empty(App::getEnv('_APP_SMS_PROVIDER'))) { if (empty(System::getEnv('_APP_SMS_PROVIDER'))) {
throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured'); throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured');
} }
@ -3889,7 +3890,7 @@ App::post('/v1/account/mfa/challenge')
switch ($factor) { switch ($factor) {
case Type::PHONE: case Type::PHONE:
if (empty(App::getEnv('_APP_SMS_PROVIDER'))) { if (empty(System::getEnv('_APP_SMS_PROVIDER'))) {
throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured'); throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured');
} }
if (empty($user->getAttribute('phone'))) { if (empty($user->getAttribute('phone'))) {
@ -3927,7 +3928,7 @@ App::post('/v1/account/mfa/challenge')
->setProviderType(MESSAGE_TYPE_SMS); ->setProviderType(MESSAGE_TYPE_SMS);
break; break;
case Type::EMAIL: case Type::EMAIL:
if (empty(App::getEnv('_APP_SMTP_HOST'))) { if (empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled'); throw new Exception(Exception::GENERAL_SMTP_DISABLED, 'SMTP disabled');
} }
if (empty($user->getAttribute('email'))) { if (empty($user->getAttribute('email'))) {
@ -3958,8 +3959,8 @@ App::post('/v1/account/mfa/challenge')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {

View file

@ -17,6 +17,7 @@ use Utopia\Domains\Domain;
use Utopia\Image\Image; use Utopia\Image\Image;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\Logger\Logger; use Utopia\Logger\Logger;
use Utopia\System\System;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\HexColor; use Utopia\Validator\HexColor;
use Utopia\Validator\Range; use Utopia\Validator\Range;
@ -155,7 +156,7 @@ $getUserGitHub = function (string $userId, Document $project, Database $dbForPro
]; ];
} catch (Exception $error) { } catch (Exception $error) {
if ($logger) { if ($logger) {
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
$log = new Log(); $log = new Log();
$log->setNamespace('console'); $log->setNamespace('console');
@ -174,7 +175,7 @@ $getUserGitHub = function (string $userId, Document $project, Database $dbForPro
$log->setAction('avatarsGetGitHub'); $log->setAction('avatarsGetGitHub');
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);
@ -348,8 +349,8 @@ App::get('/v1/avatars/favicon')
CURLOPT_URL => $url, CURLOPT_URL => $url,
CURLOPT_USERAGENT => \sprintf( CURLOPT_USERAGENT => \sprintf(
APP_USERAGENT, APP_USERAGENT,
App::getEnv('_APP_VERSION', 'UNKNOWN'), System::getEnv('_APP_VERSION', 'UNKNOWN'),
App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY) System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
), ),
]); ]);

View file

@ -4,6 +4,7 @@ use Appwrite\Extend\Exception;
use Appwrite\Utopia\Response; use Appwrite\Utopia\Response;
use Utopia\App; use Utopia\App;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\System\System;
use Utopia\Validator\Text; use Utopia\Validator\Text;
App::init() App::init()
@ -29,24 +30,24 @@ App::get('/v1/console/variables')
->label('sdk.response.model', Response::MODEL_CONSOLE_VARIABLES) ->label('sdk.response.model', Response::MODEL_CONSOLE_VARIABLES)
->inject('response') ->inject('response')
->action(function (Response $response) { ->action(function (Response $response) {
$isDomainEnabled = !empty(App::getEnv('_APP_DOMAIN', '')) $isDomainEnabled = !empty(System::getEnv('_APP_DOMAIN', ''))
&& !empty(App::getEnv('_APP_DOMAIN_TARGET', '')) && !empty(System::getEnv('_APP_DOMAIN_TARGET', ''))
&& App::getEnv('_APP_DOMAIN', '') !== 'localhost' && System::getEnv('_APP_DOMAIN', '') !== 'localhost'
&& App::getEnv('_APP_DOMAIN_TARGET', '') !== 'localhost'; && System::getEnv('_APP_DOMAIN_TARGET', '') !== 'localhost';
$isVcsEnabled = !empty(App::getEnv('_APP_VCS_GITHUB_APP_NAME', '')) $isVcsEnabled = !empty(System::getEnv('_APP_VCS_GITHUB_APP_NAME', ''))
&& !empty(App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY', '')) && !empty(System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY', ''))
&& !empty(App::getEnv('_APP_VCS_GITHUB_APP_ID', '')) && !empty(System::getEnv('_APP_VCS_GITHUB_APP_ID', ''))
&& !empty(App::getEnv('_APP_VCS_GITHUB_CLIENT_ID', '')) && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_ID', ''))
&& !empty(App::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', '')); && !empty(System::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', ''));
$isAssistantEnabled = !empty(App::getEnv('_APP_ASSISTANT_OPENAI_API_KEY', '')); $isAssistantEnabled = !empty(System::getEnv('_APP_ASSISTANT_OPENAI_API_KEY', ''));
$variables = new Document([ $variables = new Document([
'_APP_DOMAIN_TARGET' => App::getEnv('_APP_DOMAIN_TARGET'), '_APP_DOMAIN_TARGET' => System::getEnv('_APP_DOMAIN_TARGET'),
'_APP_STORAGE_LIMIT' => +App::getEnv('_APP_STORAGE_LIMIT'), '_APP_STORAGE_LIMIT' => +System::getEnv('_APP_STORAGE_LIMIT'),
'_APP_FUNCTIONS_SIZE_LIMIT' => +App::getEnv('_APP_FUNCTIONS_SIZE_LIMIT'), '_APP_FUNCTIONS_SIZE_LIMIT' => +System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT'),
'_APP_USAGE_STATS' => App::getEnv('_APP_USAGE_STATS'), '_APP_USAGE_STATS' => System::getEnv('_APP_USAGE_STATS'),
'_APP_VCS_ENABLED' => $isVcsEnabled, '_APP_VCS_ENABLED' => $isVcsEnabled,
'_APP_DOMAIN_ENABLED' => $isDomainEnabled, '_APP_DOMAIN_ENABLED' => $isDomainEnabled,
'_APP_ASSISTANT_ENABLED' => $isAssistantEnabled '_APP_ASSISTANT_ENABLED' => $isAssistantEnabled

View file

@ -40,6 +40,7 @@ use Utopia\Storage\Validator\FileExt;
use Utopia\Storage\Validator\FileSize; use Utopia\Storage\Validator\FileSize;
use Utopia\Storage\Validator\Upload; use Utopia\Storage\Validator\Upload;
use Utopia\Swoole\Request; use Utopia\Swoole\Request;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Assoc; use Utopia\Validator\Assoc;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
@ -55,8 +56,8 @@ $redeployVcs = function (Request $request, Document $function, Document $project
$deploymentId = ID::unique(); $deploymentId = ID::unique();
$entrypoint = $function->getAttribute('entrypoint', ''); $entrypoint = $function->getAttribute('entrypoint', '');
$providerInstallationId = $installation->getAttribute('providerInstallationId', ''); $providerInstallationId = $installation->getAttribute('providerInstallationId', '');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId); $owner = $github->getOwnerName($providerInstallationId);
$providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); $providerRepositoryId = $function->getAttribute('providerRepositoryId', '');
@ -144,7 +145,7 @@ App::post('/v1/functions')
->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true)
->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true)
->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
->param('timeout', 15, new Range(1, (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Function maximum execution time in seconds.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Function maximum execution time in seconds.', true)
->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true)
->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true) ->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true)
->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true)
@ -170,7 +171,7 @@ App::post('/v1/functions')
->action(function (string $functionId, string $name, string $runtime, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $commands, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateBranch, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) use ($redeployVcs) { ->action(function (string $functionId, string $name, string $runtime, array $execute, array $events, string $schedule, int $timeout, bool $enabled, bool $logging, string $entrypoint, string $commands, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateBranch, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github) use ($redeployVcs) {
$functionId = ($functionId == 'unique()') ? ID::unique() : $functionId; $functionId = ($functionId == 'unique()') ? ID::unique() : $functionId;
$allowList = \array_filter(\explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES', ''))); $allowList = \array_filter(\explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES', '')));
if (!empty($allowList) && !\in_array($runtime, $allowList)) { if (!empty($allowList) && !\in_array($runtime, $allowList)) {
throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $runtime . '" is not supported'); throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $runtime . '" is not supported');
@ -231,7 +232,7 @@ App::post('/v1/functions')
$schedule = Authorization::skip( $schedule = Authorization::skip(
fn () => $dbForConsole->createDocument('schedules', new Document([ fn () => $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region 'region' => System::getEnv('_APP_REGION', 'default'), // Todo replace with projects region
'resourceType' => 'function', 'resourceType' => 'function',
'resourceId' => $function->getId(), 'resourceId' => $function->getId(),
'resourceInternalId' => $function->getInternalId(), 'resourceInternalId' => $function->getInternalId(),
@ -280,7 +281,7 @@ App::post('/v1/functions')
$redeployVcs($request, $function, $project, $installation, $dbForProject, $queueForBuilds, $template, $github); $redeployVcs($request, $function, $project, $installation, $dbForProject, $queueForBuilds, $template, $github);
} }
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS', ''); $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', '');
if (!empty($functionsDomain)) { if (!empty($functionsDomain)) {
$ruleId = ID::unique(); $ruleId = ID::unique();
$routeSubdomain = ID::unique(); $routeSubdomain = ID::unique();
@ -422,7 +423,7 @@ App::get('/v1/functions/runtimes')
->action(function (Response $response) { ->action(function (Response $response) {
$runtimes = Config::getParam('runtimes'); $runtimes = Config::getParam('runtimes');
$allowList = \array_filter(\explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES', ''))); $allowList = \array_filter(\explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES', '')));
$allowed = []; $allowed = [];
foreach ($runtimes as $key => $runtime) { foreach ($runtimes as $key => $runtime) {
@ -675,7 +676,7 @@ App::put('/v1/functions/:functionId')
->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true)
->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true)
->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
->param('timeout', 15, new Range(1, (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Maximum execution time in seconds.', true) ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Maximum execution time in seconds.', true)
->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true)
->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true) ->param('logging', true, new Boolean(), 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', true)
->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true)
@ -1091,7 +1092,7 @@ App::post('/v1/functions/:functionId/deployments')
} }
$fileExt = new FileExt([FileExt::TYPE_GZIP]); $fileExt = new FileExt([FileExt::TYPE_GZIP]);
$fileSizeValidator = new FileSize(App::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', '30000000')); $fileSizeValidator = new FileSize(System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', '30000000'));
$upload = new Upload(); $upload = new Upload();
// Make sure we handle a single file and multiple files the same way // Make sure we handle a single file and multiple files the same way
@ -1580,7 +1581,7 @@ App::post('/v1/functions/:functionId/executions')
} }
if (!$current->isEmpty()) { if (!$current->isEmpty()) {
$jwtObj = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway.
$jwt = $jwtObj->encode([ $jwt = $jwtObj->encode([
'userId' => $user->getId(), 'userId' => $user->getId(),
'sessionId' => $current->getId(), 'sessionId' => $current->getId(),
@ -1703,7 +1704,7 @@ App::post('/v1/functions/:functionId/executions')
]); ]);
/** Execute function */ /** Execute function */
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $executor = new Executor(System::getEnv('_APP_EXECUTOR_HOST'));
try { try {
$version = $function->getAttribute('version', 'v2'); $version = $function->getAttribute('version', 'v2');
$command = $runtime['startCommand']; $command = $runtime['startCommand'];

View file

@ -17,6 +17,7 @@ use Swoole\Coroutine\WaitGroup;
use Utopia\App; use Utopia\App;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization;
use Utopia\System\System;
use Utopia\Validator\JSON; use Utopia\Validator\JSON;
use Utopia\Validator\Text; use Utopia\Validator\Text;
@ -177,9 +178,9 @@ function execute(
Adapter $promiseAdapter, Adapter $promiseAdapter,
array $query array $query
): array { ): array {
$maxBatchSize = App::getEnv('_APP_GRAPHQL_MAX_BATCH_SIZE', 10); $maxBatchSize = System::getEnv('_APP_GRAPHQL_MAX_BATCH_SIZE', 10);
$maxComplexity = App::getEnv('_APP_GRAPHQL_MAX_COMPLEXITY', 250); $maxComplexity = System::getEnv('_APP_GRAPHQL_MAX_COMPLEXITY', 250);
$maxDepth = App::getEnv('_APP_GRAPHQL_MAX_DEPTH', 3); $maxDepth = System::getEnv('_APP_GRAPHQL_MAX_DEPTH', 3);
if (!empty($query) && !isset($query[0])) { if (!empty($query) && !isset($query[0])) {
$query = [$query]; $query = [$query];
@ -199,7 +200,7 @@ function execute(
$flags = DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE; $flags = DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE;
$validations = GraphQL::getStandardValidationRules(); $validations = GraphQL::getStandardValidationRules();
if (App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') {
$validations[] = new DisableIntrospection(); $validations[] = new DisableIntrospection();
$validations[] = new QueryComplexity($maxComplexity); $validations[] = new QueryComplexity($maxComplexity);
$validations[] = new QueryDepth($maxDepth); $validations[] = new QueryDepth($maxDepth);

View file

@ -15,6 +15,7 @@ use Utopia\Registry\Registry;
use Utopia\Storage\Device; use Utopia\Storage\Device;
use Utopia\Storage\Device\Local; use Utopia\Storage\Device\Local;
use Utopia\Storage\Storage; use Utopia\Storage\Storage;
use Utopia\System\System;
use Utopia\Validator\Domain; use Utopia\Validator\Domain;
use Utopia\Validator\Integer; use Utopia\Validator\Integer;
use Utopia\Validator\Multiple; use Utopia\Validator\Multiple;
@ -816,13 +817,13 @@ App::get('/v1/health/anti-virus')
'version' => '' 'version' => ''
]; ];
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'disabled') { // Check if scans are enabled if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'disabled') { // Check if scans are enabled
$output['status'] = 'disabled'; $output['status'] = 'disabled';
$output['version'] = ''; $output['version'] = '';
} else { } else {
$antivirus = new Network( $antivirus = new Network(
App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
); );
try { try {

View file

@ -37,6 +37,7 @@ use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\Roles; use Utopia\Database\Validator\Roles;
use Utopia\Database\Validator\UID; use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale; use Utopia\Locale\Locale;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\Integer; use Utopia\Validator\Integer;
@ -2126,8 +2127,6 @@ App::get('/v1/messaging/topics/:topicId')
throw new Exception(Exception::TOPIC_NOT_FOUND); throw new Exception(Exception::TOPIC_NOT_FOUND);
} }
$topic = $dbForProject->getDocument('topics', $topicId);
$response $response
->dynamic($topic, Response::MODEL_TOPIC); ->dynamic($topic, Response::MODEL_TOPIC);
}); });
@ -2695,7 +2694,7 @@ App::post('/v1/messaging/messages/email')
break; break;
case MessageStatus::SCHEDULED: case MessageStatus::SCHEDULED:
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -2811,7 +2810,7 @@ App::post('/v1/messaging/messages/sms')
break; break;
case MessageStatus::SCHEDULED: case MessageStatus::SCHEDULED:
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -2933,8 +2932,8 @@ App::post('/v1/messaging/messages/push')
throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED);
} }
$host = App::getEnv('_APP_DOMAIN', 'localhost'); $host = System::getEnv('_APP_DOMAIN', 'localhost');
$protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
$scheduleTime = $currentScheduledAt ?? $scheduledAt; $scheduleTime = $currentScheduledAt ?? $scheduledAt;
if (!\is_null($scheduleTime)) { if (!\is_null($scheduleTime)) {
@ -2943,7 +2942,7 @@ App::post('/v1/messaging/messages/push')
$expiry = (new \DateTime())->add(new \DateInterval('P15D'))->format('U'); $expiry = (new \DateTime())->add(new \DateInterval('P15D'))->format('U');
} }
$encoder = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1')); $encoder = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'));
$jwt = $encoder->encode([ $jwt = $encoder->encode([
'iat' => \time(), 'iat' => \time(),
@ -2989,7 +2988,7 @@ App::post('/v1/messaging/messages/push')
break; break;
case MessageStatus::SCHEDULED: case MessageStatus::SCHEDULED:
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -3332,7 +3331,7 @@ App::patch('/v1/messaging/messages/email/:messageId')
if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) { if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) {
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -3503,7 +3502,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) { if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) {
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -3667,7 +3666,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) { if (\is_null($currentScheduledAt) && !\is_null($scheduledAt)) {
$schedule = $dbForConsole->createDocument('schedules', new Document([ $schedule = $dbForConsole->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), 'region' => System::getEnv('_APP_REGION', 'default'),
'resourceType' => 'message', 'resourceType' => 'message',
'resourceId' => $message->getId(), 'resourceId' => $message->getId(),
'resourceInternalId' => $message->getInternalId(), 'resourceInternalId' => $message->getInternalId(),
@ -3770,8 +3769,8 @@ App::patch('/v1/messaging/messages/push/:messageId')
throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED);
} }
$host = App::getEnv('_APP_DOMAIN', 'localhost'); $host = System::getEnv('_APP_DOMAIN', 'localhost');
$protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
$scheduleTime = $currentScheduledAt ?? $scheduledAt; $scheduleTime = $currentScheduledAt ?? $scheduledAt;
if (!\is_null($scheduleTime)) { if (!\is_null($scheduleTime)) {
@ -3780,7 +3779,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
$expiry = (new \DateTime())->add(new \DateInterval('P15D'))->format('U'); $expiry = (new \DateTime())->add(new \DateInterval('P15D'))->format('U');
} }
$encoder = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1')); $encoder = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'));
$jwt = $encoder->encode([ $jwt = $encoder->encode([
'iat' => \time(), 'iat' => \time(),

View file

@ -21,6 +21,7 @@ use Utopia\Migration\Sources\Appwrite;
use Utopia\Migration\Sources\Firebase; use Utopia\Migration\Sources\Firebase;
use Utopia\Migration\Sources\NHost; use Utopia\Migration\Sources\NHost;
use Utopia\Migration\Sources\Supabase; use Utopia\Migration\Sources\Supabase;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Host; use Utopia\Validator\Host;
use Utopia\Validator\Integer; use Utopia\Validator\Integer;
@ -109,8 +110,8 @@ App::post('/v1/migrations/firebase/oauth')
->inject('request') ->inject('request')
->action(function (array $resources, string $projectId, Response $response, Database $dbForProject, Database $dbForConsole, Document $project, Document $user, Event $queueForEvents, Migration $queueForMigrations, Request $request) { ->action(function (array $resources, string $projectId, Response $response, Database $dbForProject, Database $dbForConsole, Document $project, Document $user, Event $queueForEvents, Migration $queueForMigrations, Request $request) {
$firebase = new OAuth2Firebase( $firebase = new OAuth2Firebase(
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect' $request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
); );
@ -553,8 +554,8 @@ App::get('/v1/migrations/firebase/report/oauth')
->inject('dbForConsole') ->inject('dbForConsole')
->action(function (array $resources, string $projectId, Response $response, Request $request, Document $user, Database $dbForConsole) { ->action(function (array $resources, string $projectId, Response $response, Request $request, Document $user, Database $dbForConsole) {
$firebase = new OAuth2Firebase( $firebase = new OAuth2Firebase(
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect' $request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
); );
@ -575,7 +576,7 @@ App::get('/v1/migrations/firebase/report/oauth')
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND); throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
} }
if (App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') { if (System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND); throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
} }
@ -655,8 +656,8 @@ App::get('/v1/migrations/firebase/connect')
$dbForConsole->updateDocument('users', $user->getId(), $user); $dbForConsole->updateDocument('users', $user->getId(), $user);
$oauth2 = new OAuth2Firebase( $oauth2 = new OAuth2Firebase(
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect' $request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
); );
$url = $oauth2->getLoginURL(); $url = $oauth2->getLoginURL();
@ -710,8 +711,8 @@ App::get('/v1/migrations/firebase/redirect')
// OAuth Authroization // OAuth Authroization
if (!empty($code)) { if (!empty($code)) {
$oauth2 = new OAuth2Firebase( $oauth2 = new OAuth2Firebase(
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect' $request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
); );
@ -797,8 +798,8 @@ App::get('/v1/migrations/firebase/projects')
->inject('request') ->inject('request')
->action(function (Document $user, Response $response, Document $project, Database $dbForConsole, Request $request) { ->action(function (Document $user, Response $response, Document $project, Database $dbForConsole, Request $request) {
$firebase = new OAuth2Firebase( $firebase = new OAuth2Firebase(
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', ''),
App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''), System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', ''),
$request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect' $request->getProtocol() . '://' . $request->getHostname() . '/v1/migrations/firebase/redirect'
); );
@ -819,7 +820,7 @@ App::get('/v1/migrations/firebase/projects')
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND); throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
} }
if (App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || App::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') { if (System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_ID', '') === '' || System::getEnv('_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET', '') === '') {
throw new Exception(Exception::USER_IDENTITY_NOT_FOUND); throw new Exception(Exception::USER_IDENTITY_NOT_FOUND);
} }

View file

@ -30,6 +30,7 @@ use Utopia\Database\Validator\UID;
use Utopia\Domains\Validator\PublicDomain; use Utopia\Domains\Validator\PublicDomain;
use Utopia\Locale\Locale; use Utopia\Locale\Locale;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\Hostname; use Utopia\Validator\Hostname;
@ -62,7 +63,7 @@ App::post('/v1/projects')
->param('projectId', '', new ProjectId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can\'t start with a special char. Max length is 36 chars.') ->param('projectId', '', new ProjectId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can\'t start with a special char. Max length is 36 chars.')
->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
->param('teamId', '', new UID(), 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('region', App::getEnv('_APP_REGION', 'default'), new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn ($config) => !$config['disabled']))), 'Project Region.', true) ->param('region', System::getEnv('_APP_REGION', 'default'), new Whitelist(array_keys(array_filter(Config::getParam('regions'), fn ($config) => !$config['disabled']))), 'Project Region.', true)
->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true) ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
->param('logo', '', new Text(1024), 'Project logo.', true) ->param('logo', '', new Text(1024), 'Project logo.', true)
->param('url', '', new URL(), 'Project URL.', true) ->param('url', '', new URL(), 'Project URL.', true)
@ -84,7 +85,7 @@ App::post('/v1/projects')
throw new Exception(Exception::TEAM_NOT_FOUND); throw new Exception(Exception::TEAM_NOT_FOUND);
} }
$allowList = \array_filter(\explode(',', App::getEnv('_APP_PROJECT_REGIONS', ''))); $allowList = \array_filter(\explode(',', System::getEnv('_APP_PROJECT_REGIONS', '')));
if (!empty($allowList) && !\in_array($region, $allowList)) { if (!empty($allowList) && !\in_array($region, $allowList)) {
throw new Exception(Exception::PROJECT_REGION_UNSUPPORTED, 'Region "' . $region . '" is not supported'); throw new Exception(Exception::PROJECT_REGION_UNSUPPORTED, 'Region "' . $region . '" is not supported');
@ -127,7 +128,7 @@ App::post('/v1/projects')
} }
} }
$databaseOverride = App::getEnv('_APP_DATABASE_OVERRIDE', null); $databaseOverride = System::getEnv('_APP_DATABASE_OVERRIDE', null);
$index = array_search($databaseOverride, $databases); $index = array_search($databaseOverride, $databases);
if ($index !== false) { if ($index !== false) {
$database = $databases[$index]; $database = $databases[$index];
@ -1613,8 +1614,8 @@ App::post('/v1/projects/:projectId/smtp/tests')
->label('sdk.response.model', Response::MODEL_NONE) ->label('sdk.response.model', Response::MODEL_NONE)
->param('projectId', '', new UID(), 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->param('emails', [], new ArrayList(new Email(), 10), 'Array of emails to send test email to. Maximum of 10 emails are allowed.') ->param('emails', [], new ArrayList(new Email(), 10), 'Array of emails to send test email to. Maximum of 10 emails are allowed.')
->param('senderName', App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'), new Text(255, 0), 'Name of the email sender') ->param('senderName', System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'), new Text(255, 0), 'Name of the email sender')
->param('senderEmail', App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), new Email(), 'Email of the sender') ->param('senderEmail', System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), new Email(), 'Email of the sender')
->param('replyTo', '', new Email(), 'Reply to email', true) ->param('replyTo', '', new Email(), 'Reply to email', true)
->param('host', '', new HostName(), 'SMTP server host name') ->param('host', '', new HostName(), 'SMTP server host name')
->param('port', 587, new Integer(), 'SMTP server port', true) ->param('port', 587, new Integer(), 'SMTP server port', true)

View file

@ -16,6 +16,7 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\UID; use Utopia\Database\Validator\UID;
use Utopia\Domains\Domain; use Utopia\Domains\Domain;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\System\System;
use Utopia\Validator\Domain as ValidatorDomain; use Utopia\Validator\Domain as ValidatorDomain;
use Utopia\Validator\Text; use Utopia\Validator\Text;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
@ -44,7 +45,7 @@ App::post('/v1/proxy/rules')
->inject('dbForConsole') ->inject('dbForConsole')
->inject('dbForProject') ->inject('dbForProject')
->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForConsole, Database $dbForProject) { ->action(function (string $domain, string $resourceType, string $resourceId, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForConsole, Database $dbForProject) {
$mainDomain = App::getEnv('_APP_DOMAIN', ''); $mainDomain = System::getEnv('_APP_DOMAIN', '');
if ($domain === $mainDomain) { if ($domain === $mainDomain) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.'); throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'You cannot assign your main domain to specific resource. Please use subdomain or a different domain.');
} }
@ -108,13 +109,13 @@ App::post('/v1/proxy/rules')
]); ]);
$status = 'created'; $status = 'created';
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS'); $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS');
if (!empty($functionsDomain) && \str_ends_with($domain->get(), $functionsDomain)) { if (!empty($functionsDomain) && \str_ends_with($domain->get(), $functionsDomain)) {
$status = 'verified'; $status = 'verified';
} }
if ($status === 'created') { if ($status === 'created') {
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', '')); $target = new Domain(System::getEnv('_APP_DOMAIN_TARGET', ''));
$validator = new CNAME($target->get()); // Verify Domain with DNS records $validator = new CNAME($target->get()); // Verify Domain with DNS records
if ($validator->isValid($domain->get())) { if ($validator->isValid($domain->get())) {
@ -296,7 +297,7 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
throw new Exception(Exception::RULE_NOT_FOUND); throw new Exception(Exception::RULE_NOT_FOUND);
} }
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', '')); $target = new Domain(System::getEnv('_APP_DOMAIN_TARGET', ''));
if (!$target->isKnown() || $target->isTest()) { if (!$target->isKnown() || $target->isTest()) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Domain target must be configured as environment variable.'); throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Domain target must be configured as environment variable.');

View file

@ -39,6 +39,7 @@ use Utopia\Storage\Validator\FileExt;
use Utopia\Storage\Validator\FileSize; use Utopia\Storage\Validator\FileSize;
use Utopia\Storage\Validator\Upload; use Utopia\Storage\Validator\Upload;
use Utopia\Swoole\Request; use Utopia\Swoole\Request;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\HexColor; use Utopia\Validator\HexColor;
@ -65,7 +66,7 @@ App::post('/v1/storage/buckets')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true) ->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true)
->param('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true) ->param('maximumFileSize', (int) System::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) System::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true)
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD]), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD]), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true)
->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true)
@ -242,7 +243,7 @@ App::put('/v1/storage/buckets/:bucketId')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true) ->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true)
->param('maximumFileSize', null, new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human((int)App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true) ->param('maximumFileSize', null, new Range(1, (int) System::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human((int)System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true)
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true) ->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD]), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true) ->param('compression', Compression::NONE, new WhiteList([Compression::NONE, Compression::GZIP, Compression::ZSTD]), 'Compression algorithm choosen for compression. Can be one of ' . Compression::NONE . ', [' . Compression::GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . Compression::ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true)
->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true) ->param('encryption', true, new Boolean(true), 'Is encryption enabled? For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' encryption is skipped even if it\'s enabled', true)
@ -258,7 +259,7 @@ App::put('/v1/storage/buckets/:bucketId')
} }
$permissions ??= $bucket->getPermissions(); $permissions ??= $bucket->getPermissions();
$maximumFileSize ??= $bucket->getAttribute('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0)); $maximumFileSize ??= $bucket->getAttribute('maximumFileSize', (int) System::getEnv('_APP_STORAGE_LIMIT', 0));
$allowedFileExtensions ??= $bucket->getAttribute('allowedFileExtensions', []); $allowedFileExtensions ??= $bucket->getAttribute('allowedFileExtensions', []);
$enabled ??= $bucket->getAttribute('enabled', true); $enabled ??= $bucket->getAttribute('enabled', true);
$encryption ??= $bucket->getAttribute('encryption', true); $encryption ??= $bucket->getAttribute('encryption', true);
@ -420,7 +421,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
} }
$maximumFileSize = $bucket->getAttribute('maximumFileSize', 0); $maximumFileSize = $bucket->getAttribute('maximumFileSize', 0);
if ($maximumFileSize > (int) App::getEnv('_APP_STORAGE_LIMIT', 0)) { if ($maximumFileSize > (int) System::getEnv('_APP_STORAGE_LIMIT', 0)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Maximum bucket file size is larger than _APP_STORAGE_LIMIT'); throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Maximum bucket file size is larger than _APP_STORAGE_LIMIT');
} }
@ -522,10 +523,10 @@ App::post('/v1/storage/buckets/:bucketId/files')
} }
if ($chunksUploaded === $chunks) { if ($chunksUploaded === $chunks) {
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $deviceForFiles->getType() === Storage::DEVICE_LOCAL) { if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $deviceForFiles->getType() === Storage::DEVICE_LOCAL) {
$antivirus = new Network( $antivirus = new Network(
App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
); );
if (!$antivirus->fileScan($path)) { if (!$antivirus->fileScan($path)) {
@ -562,7 +563,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
if (empty($data)) { if (empty($data)) {
$data = $deviceForFiles->read($path); $data = $deviceForFiles->read($path);
} }
$key = App::getEnv('_APP_OPENSSL_KEY_V1'); $key = System::getEnv('_APP_OPENSSL_KEY_V1');
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
$data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag); $data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag);
} }
@ -920,7 +921,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$algorithm = $file->getAttribute('algorithm', Compression::NONE); $algorithm = $file->getAttribute('algorithm', Compression::NONE);
$cipher = $file->getAttribute('openSSLCipher'); $cipher = $file->getAttribute('openSSLCipher');
$mime = $file->getAttribute('mimeType'); $mime = $file->getAttribute('mimeType');
if (!\in_array($mime, $inputs) || $file->getAttribute('sizeActual') > (int) App::getEnv('_APP_STORAGE_PREVIEW_LIMIT', 20000000)) { if (!\in_array($mime, $inputs) || $file->getAttribute('sizeActual') > (int) System::getEnv('_APP_STORAGE_PREVIEW_LIMIT', 20000000)) {
if (!\in_array($mime, $inputs)) { if (!\in_array($mime, $inputs)) {
$path = (\array_key_exists($mime, $fileLogos)) ? $fileLogos[$mime] : $fileLogos['default']; $path = (\array_key_exists($mime, $fileLogos)) ? $fileLogos[$mime] : $fileLogos['default'];
} else { } else {
@ -957,7 +958,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$source = OpenSSL::decrypt( $source = OpenSSL::decrypt(
$source, $source,
$file->getAttribute('openSSLCipher'), $file->getAttribute('openSSLCipher'),
App::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')),
0, 0,
\hex2bin($file->getAttribute('openSSLIV')), \hex2bin($file->getAttribute('openSSLIV')),
\hex2bin($file->getAttribute('openSSLTag')) \hex2bin($file->getAttribute('openSSLTag'))
@ -1105,7 +1106,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/download')
$source = OpenSSL::decrypt( $source = OpenSSL::decrypt(
$source, $source,
$file->getAttribute('openSSLCipher'), $file->getAttribute('openSSLCipher'),
App::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')),
0, 0,
\hex2bin($file->getAttribute('openSSLIV')), \hex2bin($file->getAttribute('openSSLIV')),
\hex2bin($file->getAttribute('openSSLTag')) \hex2bin($file->getAttribute('openSSLTag'))
@ -1254,7 +1255,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/view')
$source = OpenSSL::decrypt( $source = OpenSSL::decrypt(
$source, $source,
$file->getAttribute('openSSLCipher'), $file->getAttribute('openSSLCipher'),
App::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')),
0, 0,
\hex2bin($file->getAttribute('openSSLIV')), \hex2bin($file->getAttribute('openSSLIV')),
\hex2bin($file->getAttribute('openSSLTag')) \hex2bin($file->getAttribute('openSSLTag'))
@ -1327,7 +1328,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/push')
->action(function (string $bucketId, string $fileId, string $jwt, Response $response, Request $request, Database $dbForProject, Document $project, string $mode, Device $deviceForFiles) { ->action(function (string $bucketId, string $fileId, string $jwt, Response $response, Request $request, Database $dbForProject, Document $project, string $mode, Device $deviceForFiles) {
$bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId));
$decoder = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1')); $decoder = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'));
try { try {
$decoded = $decoder->decode($jwt); $decoded = $decoder->decode($jwt);
@ -1408,7 +1409,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/push')
$source = OpenSSL::decrypt( $source = OpenSSL::decrypt(
$source, $source,
$file->getAttribute('openSSLCipher'), $file->getAttribute('openSSLCipher'),
App::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')), System::getEnv('_APP_OPENSSL_KEY_V' . $file->getAttribute('openSSLVersion')),
0, 0,
\hex2bin($file->getAttribute('openSSLIV')), \hex2bin($file->getAttribute('openSSLIV')),
\hex2bin($file->getAttribute('openSSLTag')) \hex2bin($file->getAttribute('openSSLTag'))

View file

@ -37,6 +37,7 @@ use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID; use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale; use Utopia\Locale\Locale;
use Utopia\System\System;
use Utopia\Validator\ArrayList; use Utopia\Validator\ArrayList;
use Utopia\Validator\Assoc; use Utopia\Validator\Assoc;
use Utopia\Validator\Host; use Utopia\Validator\Host;
@ -412,7 +413,7 @@ App::post('/v1/teams/:teamId/memberships')
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$isAppUser = Auth::isAppUser(Authorization::getRoles()); $isAppUser = Auth::isAppUser(Authorization::getRoles());
if (!$isPrivilegedUser && !$isAppUser && empty(App::getEnv('_APP_SMTP_HOST'))) { if (!$isPrivilegedUser && !$isAppUser && empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED); throw new Exception(Exception::GENERAL_SMTP_DISABLED);
} }
@ -575,8 +576,8 @@ App::post('/v1/teams/:teamId/memberships')
$smtp = $project->getAttribute('smtp', []); $smtp = $project->getAttribute('smtp', []);
$smtpEnabled = $smtp['enabled'] ?? false; $smtpEnabled = $smtp['enabled'] ?? false;
$senderEmail = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $senderEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$senderName = App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'); $senderName = System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server');
$replyTo = ""; $replyTo = "";
if ($smtpEnabled) { if ($smtpEnabled) {
@ -637,7 +638,7 @@ App::post('/v1/teams/:teamId/memberships')
->trigger() ->trigger()
; ;
} elseif (!empty($phone)) { } elseif (!empty($phone)) {
if (empty(App::getEnv('_APP_SMS_PROVIDER'))) { if (empty(System::getEnv('_APP_SMS_PROVIDER'))) {
throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured'); throw new Exception(Exception::GENERAL_PHONE_DISABLED, 'Phone provider not configured');
} }

View file

@ -32,6 +32,7 @@ use Utopia\Detector\Adapter\Python;
use Utopia\Detector\Adapter\Ruby; use Utopia\Detector\Adapter\Ruby;
use Utopia\Detector\Adapter\Swift; use Utopia\Detector\Adapter\Swift;
use Utopia\Detector\Detector; use Utopia\Detector\Detector;
use Utopia\System\System;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\Host; use Utopia\Validator\Host;
use Utopia\Validator\Text; use Utopia\Validator\Text;
@ -286,7 +287,7 @@ App::get('/v1/vcs/github/authorize')
'failure' => $failure, 'failure' => $failure,
]); ]);
$appName = App::getEnv('_APP_VCS_GITHUB_APP_NAME'); $appName = System::getEnv('_APP_VCS_GITHUB_APP_NAME');
if (empty($appName)) { if (empty($appName)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'GitHub App name is not configured. Please configure VCS (Version Control System) variables in .env file.'); throw new Exception(Exception::GENERAL_SERVER_ERROR, 'GitHub App name is not configured. Please configure VCS (Version Control System) variables in .env file.');
@ -357,7 +358,7 @@ App::get('/v1/vcs/github/callback')
// OAuth Authroization // OAuth Authroization
if (!empty($code)) { if (!empty($code)) {
$oauth2 = new OAuth2Github(App::getEnv('_APP_VCS_GITHUB_CLIENT_ID', ''), App::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', ''), ""); $oauth2 = new OAuth2Github(System::getEnv('_APP_VCS_GITHUB_CLIENT_ID', ''), System::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', ''), "");
$accessToken = $oauth2->getAccessToken($code) ?? ''; $accessToken = $oauth2->getAccessToken($code) ?? '';
$refreshToken = $oauth2->getRefreshToken($code) ?? ''; $refreshToken = $oauth2->getRefreshToken($code) ?? '';
$accessTokenExpiry = $oauth2->getAccessTokenExpiry($code) ?? ''; $accessTokenExpiry = $oauth2->getAccessTokenExpiry($code) ?? '';
@ -404,8 +405,8 @@ App::get('/v1/vcs/github/callback')
// Create / Update installation // Create / Update installation
if (!empty($providerInstallationId)) { if (!empty($providerInstallationId)) {
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId) ?? ''; $owner = $github->getOwnerName($providerInstallationId) ?? '';
@ -489,8 +490,8 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr
} }
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId); $owner = $github->getOwnerName($providerInstallationId);
@ -563,8 +564,8 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
} }
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$page = 1; $page = 1;
@ -655,7 +656,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
} }
if ($installation->getAttribute('personal', false) === true) { if ($installation->getAttribute('personal', false) === true) {
$oauth2 = new OAuth2Github(App::getEnv('_APP_VCS_GITHUB_CLIENT_ID', ''), App::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', ''), ""); $oauth2 = new OAuth2Github(System::getEnv('_APP_VCS_GITHUB_CLIENT_ID', ''), System::getEnv('_APP_VCS_GITHUB_CLIENT_SECRET', ''), "");
$identity = $dbForConsole->findOne('identities', [ $identity = $dbForConsole->findOne('identities', [
Query::equal('provider', ['github']), Query::equal('provider', ['github']),
@ -697,8 +698,8 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
} }
} else { } else {
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId); $owner = $github->getOwnerName($providerInstallationId);
@ -754,8 +755,8 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
} }
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId) ?? ''; $owner = $github->getOwnerName($providerInstallationId) ?? '';
@ -803,8 +804,8 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
} }
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId) ?? ''; $owner = $github->getOwnerName($providerInstallationId) ?? '';
@ -841,7 +842,7 @@ App::post('/v1/vcs/github/events')
function (GitHub $github, Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Build $queueForBuilds) use ($createGitDeployments) { function (GitHub $github, Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Build $queueForBuilds) use ($createGitDeployments) {
$payload = $request->getRawPayload(); $payload = $request->getRawPayload();
$signatureRemote = $request->getHeader('x-hub-signature-256', ''); $signatureRemote = $request->getHeader('x-hub-signature-256', '');
$signatureLocal = App::getEnv('_APP_VCS_GITHUB_WEBHOOK_SECRET', ''); $signatureLocal = System::getEnv('_APP_VCS_GITHUB_WEBHOOK_SECRET', '');
$valid = empty($signatureRemote) ? true : $github->validateWebhookEvent($payload, $signatureRemote, $signatureLocal); $valid = empty($signatureRemote) ? true : $github->validateWebhookEvent($payload, $signatureRemote, $signatureLocal);
@ -850,8 +851,8 @@ App::post('/v1/vcs/github/events')
} }
$event = $request->getHeader('x-github-event', ''); $event = $request->getHeader('x-github-event', '');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$parsedPayload = $github->getEvent($event, $payload); $parsedPayload = $github->getEvent($event, $payload);
if ($event == $github::EVENT_PUSH) { if ($event == $github::EVENT_PUSH) {
@ -1134,8 +1135,8 @@ App::patch('/v1/vcs/github/installations/:installationId/repositories/:repositor
$repository = Authorization::skip(fn () => $dbForConsole->updateDocument('repositories', $repository->getId(), $repository)); $repository = Authorization::skip(fn () => $dbForConsole->updateDocument('repositories', $repository->getId(), $repository));
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);

View file

@ -30,6 +30,7 @@ use Utopia\Locale\Locale;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\Logger\Log\User; use Utopia\Logger\Log\User;
use Utopia\Logger\Logger; use Utopia\Logger\Logger;
use Utopia\System\System;
use Utopia\Validator\Hostname; use Utopia\Validator\Hostname;
use Utopia\Validator\Text; use Utopia\Validator\Text;
@ -51,15 +52,15 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
)[0] ?? null; )[0] ?? null;
if ($route === null) { if ($route === null) {
if ($host === App::getEnv('_APP_DOMAIN_FUNCTIONS', '')) { if ($host === System::getEnv('_APP_DOMAIN_FUNCTIONS', '')) {
throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'This domain cannot be used for security reasons. Please use any subdomain instead.'); throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'This domain cannot be used for security reasons. Please use any subdomain instead.');
} }
if (\str_ends_with($host, App::getEnv('_APP_DOMAIN_FUNCTIONS', ''))) { if (\str_ends_with($host, System::getEnv('_APP_DOMAIN_FUNCTIONS', ''))) {
throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'This domain is not connected to any Appwrite resource yet. Please configure custom domain or function domain to allow this request.'); throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'This domain is not connected to any Appwrite resource yet. Please configure custom domain or function domain to allow this request.');
} }
if (App::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled') { if (System::getEnv('_APP_OPTIONS_ROUTER_PROTECTION', 'disabled') === 'enabled') {
if ($host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations if ($host !== 'localhost' && $host !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations
throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite over this domain. Please add it as custom domain to your project or disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.'); throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, 'Router protection does not allow accessing Appwrite over this domain. Please add it as custom domain to your project or disable _APP_OPTIONS_ROUTER_PROTECTION environment variable.');
} }
@ -90,7 +91,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
$type = $route->getAttribute('resourceType'); $type = $route->getAttribute('resourceType');
if ($type === 'function') { if ($type === 'function') {
if (App::getEnv('_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS if (System::getEnv('_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS
if ($request->getProtocol() !== 'https') { if ($request->getProtocol() !== 'https') {
if ($request->getMethod() !== Request::METHOD_GET) { if ($request->getMethod() !== Request::METHOD_GET) {
throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.'); throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.');
@ -250,7 +251,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
]); ]);
/** Execute function */ /** Execute function */
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $executor = new Executor(System::getEnv('_APP_EXECUTOR_HOST'));
try { try {
$version = $function->getAttribute('version', 'v2'); $version = $function->getAttribute('version', 'v2');
$command = $runtime['startCommand']; $command = $runtime['startCommand'];
@ -378,7 +379,7 @@ App::init()
* Appwrite Router * Appwrite Router
*/ */
$host = $request->getHostname() ?? ''; $host = $request->getHostname() ?? '';
$mainDomain = App::getEnv('_APP_DOMAIN', ''); $mainDomain = System::getEnv('_APP_DOMAIN', '');
// Only run Router when external domain // Only run Router when external domain
if ($host !== $mainDomain) { if ($host !== $mainDomain) {
if (router($utopia, $dbForConsole, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForUsage, $geodb)) { if (router($utopia, $dbForConsole, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForUsage, $geodb)) {
@ -396,7 +397,7 @@ App::init()
return $response->setStatusCode(404)->send('Not Found'); return $response->setStatusCode(404)->send('Not Found');
} }
$requestFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', null)); $requestFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''));
if ($requestFormat) { if ($requestFormat) {
if (version_compare($requestFormat, '1.4.0', '<')) { if (version_compare($requestFormat, '1.4.0', '<')) {
$request->addFilter(new RequestV16()); $request->addFilter(new RequestV16());
@ -419,7 +420,7 @@ App::init()
} else { } else {
Authorization::disable(); Authorization::disable();
$envDomain = App::getEnv('_APP_DOMAIN', ''); $envDomain = System::getEnv('_APP_DOMAIN', '');
$mainDomain = null; $mainDomain = null;
if (!empty($envDomain) && $envDomain !== 'localhost') { if (!empty($envDomain) && $envDomain !== 'localhost') {
$mainDomain = $envDomain; $mainDomain = $envDomain;
@ -496,7 +497,7 @@ App::init()
$isIpAddress = filter_var($request->getHostname(), FILTER_VALIDATE_IP) !== false; $isIpAddress = filter_var($request->getHostname(), FILTER_VALIDATE_IP) !== false;
$isConsoleProject = $project->getAttribute('$id', '') === 'console'; $isConsoleProject = $project->getAttribute('$id', '') === 'console';
$isConsoleRootSession = App::getEnv('_APP_CONSOLE_ROOT_SESSION', 'disabled') === 'enabled'; $isConsoleRootSession = System::getEnv('_APP_CONSOLE_ROOT_SESSION', 'disabled') === 'enabled';
Config::setParam( Config::setParam(
'cookieDomain', 'cookieDomain',
@ -512,7 +513,7 @@ App::init()
/* /*
* Response format * Response format
*/ */
$responseFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', null)); $responseFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''));
if ($responseFormat) { if ($responseFormat) {
if (version_compare($responseFormat, '1.4.0', '<')) { if (version_compare($responseFormat, '1.4.0', '<')) {
$response->addFilter(new ResponseV16()); $response->addFilter(new ResponseV16());
@ -528,7 +529,7 @@ App::init()
* As recommended at: * As recommended at:
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers * @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
*/ */
if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS if (System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS
if ($request->getProtocol() !== 'https' && ($swooleRequest->header['host'] ?? '') !== 'localhost' && ($swooleRequest->header['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations if ($request->getProtocol() !== 'https' && ($swooleRequest->header['host'] ?? '') !== 'localhost' && ($swooleRequest->header['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations
if ($request->getMethod() !== Request::METHOD_GET) { if ($request->getMethod() !== Request::METHOD_GET) {
throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.'); throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.');
@ -584,7 +585,7 @@ App::options()
* Appwrite Router * Appwrite Router
*/ */
$host = $request->getHostname() ?? ''; $host = $request->getHostname() ?? '';
$mainDomain = App::getEnv('_APP_DOMAIN', ''); $mainDomain = System::getEnv('_APP_DOMAIN', '');
// Only run Router when external domain // Only run Router when external domain
if ($host !== $mainDomain) { if ($host !== $mainDomain) {
if (router($utopia, $dbForConsole, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForUsage, $geodb)) { if (router($utopia, $dbForConsole, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForUsage, $geodb)) {
@ -613,7 +614,7 @@ App::error()
->inject('logger') ->inject('logger')
->inject('log') ->inject('log')
->action(function (Throwable $error, App $utopia, Request $request, Response $response, Document $project, ?Logger $logger, Log $log) { ->action(function (Throwable $error, App $utopia, Request $request, Response $response, Document $project, ?Logger $logger, Log $log) {
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
$route = $utopia->getRoute(); $route = $utopia->getRoute();
if ($error instanceof AppwriteException) { if ($error instanceof AppwriteException) {
@ -658,7 +659,7 @@ App::error()
$action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD"); $action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD");
$log->setAction($action); $log->setAction($action);
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);

View file

@ -12,6 +12,7 @@ use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role; use Utopia\Database\Helpers\Role;
use Utopia\Database\Validator\UID; use Utopia\Database\Validator\UID;
use Utopia\System\System;
use Utopia\Validator\Host; use Utopia\Validator\Host;
use Utopia\Validator\Text; use Utopia\Validator\Text;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
@ -136,7 +137,7 @@ App::patch('/v1/mock/functions-v2')
->inject('response') ->inject('response')
->inject('dbForProject') ->inject('dbForProject')
->action(function (string $functionId, Response $response, Database $dbForProject) { ->action(function (string $functionId, Response $response, Database $dbForProject) {
$isDevelopment = App::getEnv('_APP_ENV', 'development') === 'development'; $isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development';
if (!$isDevelopment) { if (!$isDevelopment) {
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED); throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
@ -165,7 +166,7 @@ App::get('/v1/mock/github/callback')
->inject('response') ->inject('response')
->inject('dbForConsole') ->inject('dbForConsole')
->action(function (string $providerInstallationId, string $projectId, GitHub $github, Document $project, Response $response, Database $dbForConsole) { ->action(function (string $providerInstallationId, string $projectId, GitHub $github, Document $project, Response $response, Database $dbForConsole) {
$isDevelopment = App::getEnv('_APP_ENV', 'development') === 'development'; $isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development';
if (!$isDevelopment) { if (!$isDevelopment) {
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED); throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
@ -179,8 +180,8 @@ App::get('/v1/mock/github/callback')
} }
if (!empty($providerInstallationId)) { if (!empty($providerInstallationId)) {
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
$owner = $github->getOwnerName($providerInstallationId) ?? ''; $owner = $github->getOwnerName($providerInstallationId) ?? '';

View file

@ -26,6 +26,7 @@ use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Helpers\Role; use Utopia\Database\Helpers\Role;
use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization;
use Utopia\System\System;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
$parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) { $parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) {
@ -374,7 +375,7 @@ App::init()
; ;
} }
$enabled = App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled'; $enabled = System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled';
if ( if (
$enabled // Abuse is enabled $enabled // Abuse is enabled
@ -739,7 +740,7 @@ App::shutdown()
App::init() App::init()
->groups(['usage']) ->groups(['usage'])
->action(function () { ->action(function () {
if (App::getEnv('_APP_USAGE_STATS', 'enabled') !== 'enabled') { if (System::getEnv('_APP_USAGE_STATS', 'enabled') !== 'enabled') {
throw new Exception(Exception::GENERAL_USAGE_DISABLED); throw new Exception(Exception::GENERAL_USAGE_DISABLED);
} }
}); });

View file

@ -8,6 +8,7 @@ use Utopia\App;
use Utopia\Database\DateTime; use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization;
use Utopia\System\System;
App::init() App::init()
->groups(['mfaProtected']) ->groups(['mfaProtected'])
@ -35,7 +36,7 @@ App::init()
->inject('project') ->inject('project')
->inject('geodb') ->inject('geodb')
->action(function (App $utopia, Request $request, Document $project, Reader $geodb) { ->action(function (App $utopia, Request $request, Document $project, Reader $geodb) {
$denylist = App::getEnv('_APP_CONSOLE_COUNTRIES_DENYLIST', ''); $denylist = System::getEnv('_APP_CONSOLE_COUNTRIES_DENYLIST', '');
if (!empty($denylist && $project->getId() === 'console')) { if (!empty($denylist && $project->getId() === 'console')) {
$countries = explode(',', $denylist); $countries = explode(',', $denylist);
$record = $geodb->get($request->getIP()) ?? []; $record = $geodb->get($request->getIP()) ?? [];

View file

@ -24,15 +24,16 @@ use Utopia\Logger\Log;
use Utopia\Logger\Log\User; use Utopia\Logger\Log\User;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\Swoole\Files; use Utopia\Swoole\Files;
use Utopia\System\System;
$http = new Server( $http = new Server(
host: "0.0.0.0", host: "0.0.0.0",
port: App::getEnv('PORT', 80), port: System::getEnv('PORT', 80),
mode: SWOOLE_PROCESS, mode: SWOOLE_PROCESS,
); );
$payloadSize = 6 * (1024 * 1024); // 6MB $payloadSize = 6 * (1024 * 1024); // 6MB
$workerNumber = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6)); $workerNumber = swoole_cpu_num() * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$http $http
->set([ ->set([
@ -156,7 +157,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
'$id' => ID::custom('default'), '$id' => ID::custom('default'),
'$collection' => ID::custom('buckets'), '$collection' => ID::custom('buckets'),
'name' => 'Default', 'name' => 'Default',
'maximumFileSize' => (int) App::getEnv('_APP_STORAGE_LIMIT', 0), // 10MB 'maximumFileSize' => (int) System::getEnv('_APP_STORAGE_LIMIT', 0), // 10MB
'allowedFileExtensions' => [], 'allowedFileExtensions' => [],
'enabled' => true, 'enabled' => true,
'compression' => 'gzip', 'compression' => 'gzip',
@ -255,7 +256,7 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
$app->run($request, $response); $app->run($request, $response);
} catch (\Throwable $th) { } catch (\Throwable $th) {
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
$logger = $app->getResource("logger"); $logger = $app->getResource("logger");
if ($logger) { if ($logger) {
@ -297,7 +298,7 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
$action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD"); $action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD");
$log->setAction($action); $log->setAction($action);
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);

View file

@ -77,6 +77,7 @@ use Utopia\Storage\Device\Local;
use Utopia\Storage\Device\S3; use Utopia\Storage\Device\S3;
use Utopia\Storage\Device\Wasabi; use Utopia\Storage\Device\Wasabi;
use Utopia\Storage\Storage; use Utopia\Storage\Storage;
use Utopia\System\System;
use Utopia\Validator\Hostname; use Utopia\Validator\Hostname;
use Utopia\Validator\IP; use Utopia\Validator\IP;
use Utopia\Validator\Range; use Utopia\Validator\Range;
@ -244,7 +245,7 @@ const METRIC_NETWORK_OUTBOUND = 'network.outbound';
$register = new Registry(); $register = new Registry();
App::setMode(App::getEnv('_APP_ENV', App::MODE_TYPE_PRODUCTION)); App::setMode(System::getEnv('_APP_ENV', App::MODE_TYPE_PRODUCTION));
if (!App::isProduction()) { if (!App::isProduction()) {
// Allow specific domains to skip public domain validation in dev environment // Allow specific domains to skip public domain validation in dev environment
@ -517,7 +518,7 @@ Database::addFilter(
Database::addFilter( Database::addFilter(
'encrypt', 'encrypt',
function (mixed $value) { function (mixed $value) {
$key = App::getEnv('_APP_OPENSSL_KEY_V1'); $key = System::getEnv('_APP_OPENSSL_KEY_V1');
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
$tag = null; $tag = null;
@ -534,7 +535,7 @@ Database::addFilter(
return; return;
} }
$value = json_decode($value, true); $value = json_decode($value, true);
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $value['version']); $key = System::getEnv('_APP_OPENSSL_KEY_V' . $value['version']);
return OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag'])); return OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag']));
} }
@ -720,8 +721,8 @@ Structure::addFormat(APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, function ($attribute) {
*/ */
$register->set('logger', function () { $register->set('logger', function () {
// Register error logger // Register error logger
$providerName = App::getEnv('_APP_LOGGING_PROVIDER', ''); $providerName = System::getEnv('_APP_LOGGING_PROVIDER', '');
$providerConfig = App::getEnv('_APP_LOGGING_CONFIG', ''); $providerConfig = System::getEnv('_APP_LOGGING_CONFIG', '');
if (empty($providerName) || empty($providerConfig)) { if (empty($providerName) || empty($providerConfig)) {
return; return;
@ -740,60 +741,60 @@ $register->set('pools', function () {
$fallbackForDB = 'db_main=' . AppwriteURL::unparse([ $fallbackForDB = 'db_main=' . AppwriteURL::unparse([
'scheme' => 'mariadb', 'scheme' => 'mariadb',
'host' => App::getEnv('_APP_DB_HOST', 'mariadb'), 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'),
'port' => App::getEnv('_APP_DB_PORT', '3306'), 'port' => System::getEnv('_APP_DB_PORT', '3306'),
'user' => App::getEnv('_APP_DB_USER', ''), 'user' => System::getEnv('_APP_DB_USER', ''),
'pass' => App::getEnv('_APP_DB_PASS', ''), 'pass' => System::getEnv('_APP_DB_PASS', ''),
'path' => App::getEnv('_APP_DB_SCHEMA', ''), 'path' => System::getEnv('_APP_DB_SCHEMA', ''),
]); ]);
$fallbackForRedis = 'redis_main=' . AppwriteURL::unparse([ $fallbackForRedis = 'redis_main=' . AppwriteURL::unparse([
'scheme' => 'redis', 'scheme' => 'redis',
'host' => App::getEnv('_APP_REDIS_HOST', 'redis'), 'host' => System::getEnv('_APP_REDIS_HOST', 'redis'),
'port' => App::getEnv('_APP_REDIS_PORT', '6379'), 'port' => System::getEnv('_APP_REDIS_PORT', '6379'),
'user' => App::getEnv('_APP_REDIS_USER', ''), 'user' => System::getEnv('_APP_REDIS_USER', ''),
'pass' => App::getEnv('_APP_REDIS_PASS', ''), 'pass' => System::getEnv('_APP_REDIS_PASS', ''),
]); ]);
$connections = [ $connections = [
'console' => [ 'console' => [
'type' => 'database', 'type' => 'database',
'dsns' => App::getEnv('_APP_CONNECTIONS_DB_CONSOLE', $fallbackForDB), 'dsns' => System::getEnv('_APP_CONNECTIONS_DB_CONSOLE', $fallbackForDB),
'multiple' => false, 'multiple' => false,
'schemes' => ['mariadb', 'mysql'], 'schemes' => ['mariadb', 'mysql'],
], ],
'database' => [ 'database' => [
'type' => 'database', 'type' => 'database',
'dsns' => App::getEnv('_APP_CONNECTIONS_DB_PROJECT', $fallbackForDB), 'dsns' => System::getEnv('_APP_CONNECTIONS_DB_PROJECT', $fallbackForDB),
'multiple' => true, 'multiple' => true,
'schemes' => ['mariadb', 'mysql'], 'schemes' => ['mariadb', 'mysql'],
], ],
'queue' => [ 'queue' => [
'type' => 'queue', 'type' => 'queue',
'dsns' => App::getEnv('_APP_CONNECTIONS_QUEUE', $fallbackForRedis), 'dsns' => System::getEnv('_APP_CONNECTIONS_QUEUE', $fallbackForRedis),
'multiple' => false, 'multiple' => false,
'schemes' => ['redis'], 'schemes' => ['redis'],
], ],
'pubsub' => [ 'pubsub' => [
'type' => 'pubsub', 'type' => 'pubsub',
'dsns' => App::getEnv('_APP_CONNECTIONS_PUBSUB', $fallbackForRedis), 'dsns' => System::getEnv('_APP_CONNECTIONS_PUBSUB', $fallbackForRedis),
'multiple' => false, 'multiple' => false,
'schemes' => ['redis'], 'schemes' => ['redis'],
], ],
'cache' => [ 'cache' => [
'type' => 'cache', 'type' => 'cache',
'dsns' => App::getEnv('_APP_CONNECTIONS_CACHE', $fallbackForRedis), 'dsns' => System::getEnv('_APP_CONNECTIONS_CACHE', $fallbackForRedis),
'multiple' => true, 'multiple' => true,
'schemes' => ['redis'], 'schemes' => ['redis'],
], ],
]; ];
$maxConnections = App::getEnv('_APP_CONNECTIONS_MAX', 151); $maxConnections = System::getEnv('_APP_CONNECTIONS_MAX', 151);
$instanceConnections = $maxConnections / App::getEnv('_APP_POOL_CLIENTS', 14); $instanceConnections = $maxConnections / System::getEnv('_APP_POOL_CLIENTS', 14);
$multiprocessing = App::getEnv('_APP_SERVER_MULTIPROCESS', 'disabled') === 'enabled'; $multiprocessing = System::getEnv('_APP_SERVER_MULTIPROCESS', 'disabled') === 'enabled';
if ($multiprocessing) { if ($multiprocessing) {
$workerCount = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6)); $workerCount = swoole_cpu_num() * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
} else { } else {
$workerCount = 1; $workerCount = 1;
} }
@ -919,11 +920,11 @@ $register->set('pools', function () {
$register->set('db', function () { $register->set('db', function () {
// This is usually for our workers or CLI commands scope // This is usually for our workers or CLI commands scope
$dbHost = App::getEnv('_APP_DB_HOST', ''); $dbHost = System::getEnv('_APP_DB_HOST', '');
$dbPort = App::getEnv('_APP_DB_PORT', ''); $dbPort = System::getEnv('_APP_DB_PORT', '');
$dbUser = App::getEnv('_APP_DB_USER', ''); $dbUser = System::getEnv('_APP_DB_USER', '');
$dbPass = App::getEnv('_APP_DB_PASS', ''); $dbPass = System::getEnv('_APP_DB_PASS', '');
$dbScheme = App::getEnv('_APP_DB_SCHEMA', ''); $dbScheme = System::getEnv('_APP_DB_SCHEMA', '');
return new PDO( return new PDO(
"mysql:host={$dbHost};port={$dbPort};dbname={$dbScheme};charset=utf8mb4", "mysql:host={$dbHost};port={$dbPort};dbname={$dbScheme};charset=utf8mb4",
@ -938,21 +939,21 @@ $register->set('smtp', function () {
$mail->isSMTP(); $mail->isSMTP();
$username = App::getEnv('_APP_SMTP_USERNAME'); $username = System::getEnv('_APP_SMTP_USERNAME');
$password = App::getEnv('_APP_SMTP_PASSWORD'); $password = System::getEnv('_APP_SMTP_PASSWORD');
$mail->XMailer = 'Appwrite Mailer'; $mail->XMailer = 'Appwrite Mailer';
$mail->Host = App::getEnv('_APP_SMTP_HOST', 'smtp'); $mail->Host = System::getEnv('_APP_SMTP_HOST', 'smtp');
$mail->Port = App::getEnv('_APP_SMTP_PORT', 25); $mail->Port = System::getEnv('_APP_SMTP_PORT', 25);
$mail->SMTPAuth = !empty($username) && !empty($password); $mail->SMTPAuth = !empty($username) && !empty($password);
$mail->Username = $username; $mail->Username = $username;
$mail->Password = $password; $mail->Password = $password;
$mail->SMTPSecure = App::getEnv('_APP_SMTP_SECURE', ''); $mail->SMTPSecure = System::getEnv('_APP_SMTP_SECURE', '');
$mail->SMTPAutoTLS = false; $mail->SMTPAutoTLS = false;
$mail->CharSet = 'UTF-8'; $mail->CharSet = 'UTF-8';
$from = \urldecode(App::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server')); $from = \urldecode(System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server'));
$email = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $email = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$mail->setFrom($email, $from); $mail->setFrom($email, $from);
$mail->addReplyTo($email, $from); $mail->addReplyTo($email, $from);
@ -1003,8 +1004,8 @@ foreach ($locales as $locale) {
'method' => 'GET', 'method' => 'GET',
'user_agent' => \sprintf( 'user_agent' => \sprintf(
APP_USERAGENT, APP_USERAGENT,
App::getEnv('_APP_VERSION', 'UNKNOWN'), System::getEnv('_APP_VERSION', 'UNKNOWN'),
App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY) System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
), ),
'timeout' => 2, 'timeout' => 2,
], ],
@ -1021,7 +1022,7 @@ App::setResource('hooks', function ($register) {
}, ['register']); }, ['register']);
App::setResource('register', fn () => $register); App::setResource('register', fn () => $register);
App::setResource('locale', fn () => new Locale(App::getEnv('_APP_LOCALE', 'en'))); App::setResource('locale', fn () => new Locale(System::getEnv('_APP_LOCALE', 'en')));
App::setResource('localeCodes', function () { App::setResource('localeCodes', function () {
return array_map(fn ($locale) => $locale['code'], Config::getParam('locale-codes', [])); return array_map(fn ($locale) => $locale['code'], Config::getParam('locale-codes', []));
@ -1072,7 +1073,7 @@ App::setResource('clients', function ($request, $console, $project) {
'hostname' => $request->getHostname(), 'hostname' => $request->getHostname(),
], Document::SET_TYPE_APPEND); ], Document::SET_TYPE_APPEND);
$hostnames = explode(',', App::getEnv('_APP_CONSOLE_HOSTNAMES', '')); $hostnames = explode(',', System::getEnv('_APP_CONSOLE_HOSTNAMES', ''));
$validator = new Hostname(); $validator = new Hostname();
foreach ($hostnames as $hostname) { foreach ($hostnames as $hostname) {
$hostname = trim($hostname); $hostname = trim($hostname);
@ -1196,7 +1197,7 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons
$authJWT = $request->getHeader('x-appwrite-jwt', ''); $authJWT = $request->getHeader('x-appwrite-jwt', '');
if (!empty($authJWT) && !$project->isEmpty()) { // JWT authentication if (!empty($authJWT) && !$project->isEmpty()) { // JWT authentication
$jwt = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway. $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway.
try { try {
$payload = $jwt->decode($authJWT); $payload = $jwt->decode($authJWT);
@ -1286,16 +1287,16 @@ App::setResource('console', function () {
'legalAddress' => '', 'legalAddress' => '',
'legalTaxId' => '', 'legalTaxId' => '',
'auths' => [ 'auths' => [
'invites' => App::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled', 'invites' => System::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled',
'limit' => (App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user 'limit' => (System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG, // 1 Year in seconds 'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG, // 1 Year in seconds
], ],
'authWhitelistEmails' => (!empty(App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [], 'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [],
'authWhitelistIPs' => (!empty(App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [], 'authWhitelistIPs' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [],
'oAuthProviders' => [ 'oAuthProviders' => [
'githubEnabled' => true, 'githubEnabled' => true,
'githubSecret' => App::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''), 'githubSecret' => System::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''),
'githubAppid' => App::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '') 'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '')
], ],
]); ]);
}, []); }, []);
@ -1415,7 +1416,7 @@ App::setResource('deviceForBuilds', function ($project) {
function getDevice($root): Device function getDevice($root): Device
{ {
$connection = App::getEnv('_APP_CONNECTIONS_STORAGE', ''); $connection = System::getEnv('_APP_CONNECTIONS_STORAGE', '');
if (!empty($connection)) { if (!empty($connection)) {
$acl = 'private'; $acl = 'private';
@ -1452,43 +1453,43 @@ function getDevice($root): Device
return new Local($root); return new Local($root);
} }
} else { } else {
switch (strtolower(App::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) ?? '')) { switch (strtolower(System::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) ?? '')) {
case Storage::DEVICE_LOCAL: case Storage::DEVICE_LOCAL:
default: default:
return new Local($root); return new Local($root);
case Storage::DEVICE_S3: case Storage::DEVICE_S3:
$s3AccessKey = App::getEnv('_APP_STORAGE_S3_ACCESS_KEY', ''); $s3AccessKey = System::getEnv('_APP_STORAGE_S3_ACCESS_KEY', '');
$s3SecretKey = App::getEnv('_APP_STORAGE_S3_SECRET', ''); $s3SecretKey = System::getEnv('_APP_STORAGE_S3_SECRET', '');
$s3Region = App::getEnv('_APP_STORAGE_S3_REGION', ''); $s3Region = System::getEnv('_APP_STORAGE_S3_REGION', '');
$s3Bucket = App::getEnv('_APP_STORAGE_S3_BUCKET', ''); $s3Bucket = System::getEnv('_APP_STORAGE_S3_BUCKET', '');
$s3Acl = 'private'; $s3Acl = 'private';
return new S3($root, $s3AccessKey, $s3SecretKey, $s3Bucket, $s3Region, $s3Acl); return new S3($root, $s3AccessKey, $s3SecretKey, $s3Bucket, $s3Region, $s3Acl);
case Storage::DEVICE_DO_SPACES: case Storage::DEVICE_DO_SPACES:
$doSpacesAccessKey = App::getEnv('_APP_STORAGE_DO_SPACES_ACCESS_KEY', ''); $doSpacesAccessKey = System::getEnv('_APP_STORAGE_DO_SPACES_ACCESS_KEY', '');
$doSpacesSecretKey = App::getEnv('_APP_STORAGE_DO_SPACES_SECRET', ''); $doSpacesSecretKey = System::getEnv('_APP_STORAGE_DO_SPACES_SECRET', '');
$doSpacesRegion = App::getEnv('_APP_STORAGE_DO_SPACES_REGION', ''); $doSpacesRegion = System::getEnv('_APP_STORAGE_DO_SPACES_REGION', '');
$doSpacesBucket = App::getEnv('_APP_STORAGE_DO_SPACES_BUCKET', ''); $doSpacesBucket = System::getEnv('_APP_STORAGE_DO_SPACES_BUCKET', '');
$doSpacesAcl = 'private'; $doSpacesAcl = 'private';
return new DOSpaces($root, $doSpacesAccessKey, $doSpacesSecretKey, $doSpacesBucket, $doSpacesRegion, $doSpacesAcl); return new DOSpaces($root, $doSpacesAccessKey, $doSpacesSecretKey, $doSpacesBucket, $doSpacesRegion, $doSpacesAcl);
case Storage::DEVICE_BACKBLAZE: case Storage::DEVICE_BACKBLAZE:
$backblazeAccessKey = App::getEnv('_APP_STORAGE_BACKBLAZE_ACCESS_KEY', ''); $backblazeAccessKey = System::getEnv('_APP_STORAGE_BACKBLAZE_ACCESS_KEY', '');
$backblazeSecretKey = App::getEnv('_APP_STORAGE_BACKBLAZE_SECRET', ''); $backblazeSecretKey = System::getEnv('_APP_STORAGE_BACKBLAZE_SECRET', '');
$backblazeRegion = App::getEnv('_APP_STORAGE_BACKBLAZE_REGION', ''); $backblazeRegion = System::getEnv('_APP_STORAGE_BACKBLAZE_REGION', '');
$backblazeBucket = App::getEnv('_APP_STORAGE_BACKBLAZE_BUCKET', ''); $backblazeBucket = System::getEnv('_APP_STORAGE_BACKBLAZE_BUCKET', '');
$backblazeAcl = 'private'; $backblazeAcl = 'private';
return new Backblaze($root, $backblazeAccessKey, $backblazeSecretKey, $backblazeBucket, $backblazeRegion, $backblazeAcl); return new Backblaze($root, $backblazeAccessKey, $backblazeSecretKey, $backblazeBucket, $backblazeRegion, $backblazeAcl);
case Storage::DEVICE_LINODE: case Storage::DEVICE_LINODE:
$linodeAccessKey = App::getEnv('_APP_STORAGE_LINODE_ACCESS_KEY', ''); $linodeAccessKey = System::getEnv('_APP_STORAGE_LINODE_ACCESS_KEY', '');
$linodeSecretKey = App::getEnv('_APP_STORAGE_LINODE_SECRET', ''); $linodeSecretKey = System::getEnv('_APP_STORAGE_LINODE_SECRET', '');
$linodeRegion = App::getEnv('_APP_STORAGE_LINODE_REGION', ''); $linodeRegion = System::getEnv('_APP_STORAGE_LINODE_REGION', '');
$linodeBucket = App::getEnv('_APP_STORAGE_LINODE_BUCKET', ''); $linodeBucket = System::getEnv('_APP_STORAGE_LINODE_BUCKET', '');
$linodeAcl = 'private'; $linodeAcl = 'private';
return new Linode($root, $linodeAccessKey, $linodeSecretKey, $linodeBucket, $linodeRegion, $linodeAcl); return new Linode($root, $linodeAccessKey, $linodeSecretKey, $linodeBucket, $linodeRegion, $linodeAcl);
case Storage::DEVICE_WASABI: case Storage::DEVICE_WASABI:
$wasabiAccessKey = App::getEnv('_APP_STORAGE_WASABI_ACCESS_KEY', ''); $wasabiAccessKey = System::getEnv('_APP_STORAGE_WASABI_ACCESS_KEY', '');
$wasabiSecretKey = App::getEnv('_APP_STORAGE_WASABI_SECRET', ''); $wasabiSecretKey = System::getEnv('_APP_STORAGE_WASABI_SECRET', '');
$wasabiRegion = App::getEnv('_APP_STORAGE_WASABI_REGION', ''); $wasabiRegion = System::getEnv('_APP_STORAGE_WASABI_REGION', '');
$wasabiBucket = App::getEnv('_APP_STORAGE_WASABI_BUCKET', ''); $wasabiBucket = System::getEnv('_APP_STORAGE_WASABI_BUCKET', '');
$wasabiAcl = 'private'; $wasabiAcl = 'private';
return new Wasabi($root, $wasabiAccessKey, $wasabiSecretKey, $wasabiBucket, $wasabiRegion, $wasabiAcl); return new Wasabi($root, $wasabiAccessKey, $wasabiSecretKey, $wasabiBucket, $wasabiRegion, $wasabiAcl);
} }

View file

@ -27,6 +27,7 @@ use Utopia\Database\Helpers\Role;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\System\System;
use Utopia\WebSocket\Adapter; use Utopia\WebSocket\Adapter;
use Utopia\WebSocket\Server; use Utopia\WebSocket\Server;
@ -122,9 +123,9 @@ $stats->create();
$containerId = uniqid(); $containerId = uniqid();
$statsDocument = null; $statsDocument = null;
$workerNumber = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6)); $workerNumber = swoole_cpu_num() * intval(System::getEnv('_APP_WORKER_PER_CORE', 6));
$adapter = new Adapter\Swoole(port: App::getEnv('PORT', 80)); $adapter = new Adapter\Swoole(port: System::getEnv('PORT', 80));
$adapter $adapter
->setPackageMaxLength(64000) // Default maximum Package Size (64kb) ->setPackageMaxLength(64000) // Default maximum Package Size (64kb)
->setWorkerNumber($workerNumber); ->setWorkerNumber($workerNumber);
@ -135,7 +136,7 @@ $logError = function (Throwable $error, string $action) use ($register) {
$logger = $register->get('logger'); $logger = $register->get('logger');
if ($logger && !$error instanceof Exception) { if ($logger && !$error instanceof Exception) {
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
$log = new Log(); $log = new Log();
$log->setNamespace("realtime"); $log->setNamespace("realtime");
@ -154,7 +155,7 @@ $logError = function (Throwable $error, string $action) use ($register) {
$log->setAction($action); $log->setAction($action);
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);
@ -435,7 +436,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
$abuse = new Abuse($timeLimit); $abuse = new Abuse($timeLimit);
if (App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) { if (System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) {
throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many requests'); throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many requests');
} }
@ -530,7 +531,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
$abuse = new Abuse($timeLimit); $abuse = new Abuse($timeLimit);
if ($abuse->check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') { if ($abuse->check() && System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') {
throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many messages.'); throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many messages.');
} }

View file

@ -17,7 +17,6 @@ use Appwrite\Event\Usage;
use Appwrite\Event\UsageDump; use Appwrite\Event\UsageDump;
use Appwrite\Platform\Appwrite; use Appwrite\Platform\Appwrite;
use Swoole\Runtime; use Swoole\Runtime;
use Utopia\App;
use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
use Utopia\CLI\Console; use Utopia\CLI\Console;
@ -35,6 +34,7 @@ use Utopia\Queue\Message;
use Utopia\Queue\Server; use Utopia\Queue\Server;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\Storage\Device\Local; use Utopia\Storage\Device\Local;
use Utopia\System\System;
Authorization::disable(); Authorization::disable();
Runtime::enableCoroutine(SWOOLE_HOOK_ALL); Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
@ -113,15 +113,15 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForConso
}, ['pools', 'dbForConsole', 'cache']); }, ['pools', 'dbForConsole', 'cache']);
Server::setResource('abuseRetention', function () { Server::setResource('abuseRetention', function () {
return DateTime::addSeconds(new \DateTime(), -1 * App::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', 86400)); return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', 86400));
}); });
Server::setResource('auditRetention', function () { Server::setResource('auditRetention', function () {
return DateTime::addSeconds(new \DateTime(), -1 * App::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', 1209600)); return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', 1209600));
}); });
Server::setResource('executionRetention', function () { Server::setResource('executionRetention', function () {
return DateTime::addSeconds(new \DateTime(), -1 * App::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', 1209600)); return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', 1209600));
}); });
Server::setResource('cache', function (Registry $register) { Server::setResource('cache', function (Registry $register) {
@ -244,9 +244,9 @@ if (!empty($workerIndex)) {
} }
if (\str_starts_with($workerName, 'databases')) { if (\str_starts_with($workerName, 'databases')) {
$queueName = App::getEnv('_APP_QUEUE_NAME', 'database_db_main'); $queueName = System::getEnv('_APP_QUEUE_NAME', 'database_db_main');
} else { } else {
$queueName = App::getEnv('_APP_QUEUE_NAME', 'v1-' . strtolower($workerName)); $queueName = System::getEnv('_APP_QUEUE_NAME', 'v1-' . strtolower($workerName));
} }
try { try {
@ -257,7 +257,7 @@ try {
* - _APP_QUEUE_NAME The name of the queue to read for database events * - _APP_QUEUE_NAME The name of the queue to read for database events
*/ */
$platform->init(Service::TYPE_WORKER, [ $platform->init(Service::TYPE_WORKER, [
'workersNum' => App::getEnv('_APP_WORKERS_NUM', 1), 'workersNum' => System::getEnv('_APP_WORKERS_NUM', 1),
'connection' => $pools->get('queue')->pop()->getResource(), 'connection' => $pools->get('queue')->pop()->getResource(),
'workerName' => strtolower($workerName) ?? null, 'workerName' => strtolower($workerName) ?? null,
'queueName' => $queueName 'queueName' => $queueName
@ -284,7 +284,7 @@ $worker
->inject('project') ->inject('project')
->action(function (Throwable $error, ?Logger $logger, Log $log, Group $pools, Document $project) use ($queueName) { ->action(function (Throwable $error, ?Logger $logger, Log $log, Group $pools, Document $project) use ($queueName) {
$pools->reclaim(); $pools->reclaim();
$version = App::getEnv('_APP_VERSION', 'UNKNOWN'); $version = System::getEnv('_APP_VERSION', 'UNKNOWN');
if ($error instanceof PDOException) { if ($error instanceof PDOException) {
throw $error; throw $error;
@ -306,7 +306,7 @@ $worker
$log->addExtra('detailedTrace', $error->getTrace()); $log->addExtra('detailedTrace', $error->getTrace());
$log->addExtra('roles', Authorization::getRoles()); $log->addExtra('roles', Authorization::getRoles());
$isProduction = App::getEnv('_APP_ENV', 'development') === 'production'; $isProduction = System::getEnv('_APP_ENV', 'development') === 'production';
$log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $log->setEnvironment($isProduction ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING);
$responseCode = $logger->addLog($log); $responseCode = $logger->addLog($log);

View file

@ -66,6 +66,7 @@
"utopia-php/registry": "0.5.*", "utopia-php/registry": "0.5.*",
"utopia-php/storage": "0.18.*", "utopia-php/storage": "0.18.*",
"utopia-php/swoole": "0.8.*", "utopia-php/swoole": "0.8.*",
"utopia-php/system": "0.8.*",
"utopia-php/vcs": "0.6.*", "utopia-php/vcs": "0.6.*",
"utopia-php/websocket": "0.1.*", "utopia-php/websocket": "0.1.*",
"matomo/device-detector": "6.1.*", "matomo/device-detector": "6.1.*",

50
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "92244aad23e8d26c034633397692c1fc", "content-hash": "78b9cd75952805a2347578f4fcb96add",
"packages": [ "packages": [
{ {
"name": "adhocore/jwt", "name": "adhocore/jwt",
@ -156,21 +156,21 @@
}, },
{ {
"name": "appwrite/php-runtimes", "name": "appwrite/php-runtimes",
"version": "0.13.3", "version": "0.13.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/appwrite/runtimes.git", "url": "https://github.com/appwrite/runtimes.git",
"reference": "5d93fc578a9a543bcdc9b2c0562d80a51d56c73d" "reference": "ba24c3a163f1a1da6cd355db92def508d05e59f7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/appwrite/runtimes/zipball/5d93fc578a9a543bcdc9b2c0562d80a51d56c73d", "url": "https://api.github.com/repos/appwrite/runtimes/zipball/ba24c3a163f1a1da6cd355db92def508d05e59f7",
"reference": "5d93fc578a9a543bcdc9b2c0562d80a51d56c73d", "reference": "ba24c3a163f1a1da6cd355db92def508d05e59f7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.0", "php": ">=8.0",
"utopia-php/system": "0.7.*" "utopia-php/system": "0.8.*"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.3", "phpunit/phpunit": "^9.3",
@ -204,9 +204,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/appwrite/runtimes/issues", "issues": "https://github.com/appwrite/runtimes/issues",
"source": "https://github.com/appwrite/runtimes/tree/0.13.3" "source": "https://github.com/appwrite/runtimes/tree/0.13.5"
}, },
"time": "2024-03-01T14:47:47+00:00" "time": "2024-04-01T10:35:02+00:00"
}, },
{ {
"name": "beberlei/assert", "name": "beberlei/assert",
@ -2443,16 +2443,16 @@
}, },
{ {
"name": "utopia-php/system", "name": "utopia-php/system",
"version": "0.7.2", "version": "0.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/system.git", "url": "https://github.com/utopia-php/system.git",
"reference": "4593d4d334b0c15879c4744a826e0362924c5d66" "reference": "a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/system/zipball/4593d4d334b0c15879c4744a826e0362924c5d66", "url": "https://api.github.com/repos/utopia-php/system/zipball/a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e",
"reference": "4593d4d334b0c15879c4744a826e0362924c5d66", "reference": "a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2493,9 +2493,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/system/issues", "issues": "https://github.com/utopia-php/system/issues",
"source": "https://github.com/utopia-php/system/tree/0.7.2" "source": "https://github.com/utopia-php/system/tree/0.8.0"
}, },
"time": "2023-10-20T01:39:17+00:00" "time": "2024-04-01T10:22:28+00:00"
}, },
{ {
"name": "utopia-php/vcs", "name": "utopia-php/vcs",
@ -2731,16 +2731,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "appwrite/sdk-generator", "name": "appwrite/sdk-generator",
"version": "0.37.8", "version": "0.37.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/appwrite/sdk-generator.git", "url": "https://github.com/appwrite/sdk-generator.git",
"reference": "29844ac860237018a5d6bce17f8b591c996081ef" "reference": "ad80d80e18f0cda981e1bddbf0841a805632caa0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/29844ac860237018a5d6bce17f8b591c996081ef", "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ad80d80e18f0cda981e1bddbf0841a805632caa0",
"reference": "29844ac860237018a5d6bce17f8b591c996081ef", "reference": "ad80d80e18f0cda981e1bddbf0841a805632caa0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2776,9 +2776,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": { "support": {
"issues": "https://github.com/appwrite/sdk-generator/issues", "issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.37.8" "source": "https://github.com/appwrite/sdk-generator/tree/0.37.9"
}, },
"time": "2024-03-12T14:13:43+00:00" "time": "2024-03-24T05:40:55+00:00"
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",
@ -2899,16 +2899,16 @@
}, },
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.14.0", "version": "v1.15.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/pint.git", "url": "https://github.com/laravel/pint.git",
"reference": "6b127276e3f263f7bb17d5077e9e0269e61b2a0e" "reference": "c52de679b3ac01207016c179d7ce173e4be128c4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/6b127276e3f263f7bb17d5077e9e0269e61b2a0e", "url": "https://api.github.com/repos/laravel/pint/zipball/c52de679b3ac01207016c179d7ce173e4be128c4",
"reference": "6b127276e3f263f7bb17d5077e9e0269e61b2a0e", "reference": "c52de679b3ac01207016c179d7ce173e4be128c4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2961,7 +2961,7 @@
"issues": "https://github.com/laravel/pint/issues", "issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint" "source": "https://github.com/laravel/pint"
}, },
"time": "2024-02-20T17:38:05+00:00" "time": "2024-03-26T16:40:24+00:00"
}, },
{ {
"name": "matthiasmullie/minify", "name": "matthiasmullie/minify",

View file

@ -88,7 +88,7 @@ class Autodesk extends OAuth2
'client_id' => $this->appID, 'client_id' => $this->appID,
'client_secret' => $this->appSecret, 'client_secret' => $this->appSecret,
'grant_type' => 'refresh_token', 'grant_type' => 'refresh_token',
'code' => $code, 'code' => $refreshToken,
'redirect_uri' => $this->callback, 'redirect_uri' => $this->callback,
]) ])
); );

View file

@ -9,6 +9,7 @@ use Appwrite\Utopia\Response;
use Utopia\App; use Utopia\App;
use Utopia\Exception; use Utopia\Exception;
use Utopia\Route; use Utopia\Route;
use Utopia\System\System;
class Resolvers class Resolvers
{ {
@ -302,7 +303,7 @@ class Resolvers
private static function escapePayload(array $payload, int $depth) private static function escapePayload(array $payload, int $depth)
{ {
if ($depth > App::getEnv('_APP_GRAPHQL_MAX_DEPTH', 3)) { if ($depth > System::getEnv('_APP_GRAPHQL_MAX_DEPTH', 3)) {
return; return;
} }

View file

@ -3,11 +3,11 @@
namespace Appwrite\Messaging\Adapter; namespace Appwrite\Messaging\Adapter;
use Appwrite\Messaging\Adapter; use Appwrite\Messaging\Adapter;
use Utopia\App;
use Utopia\Database\DateTime; use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Role; use Utopia\Database\Helpers\Role;
use Utopia\System\System;
class Realtime extends Adapter class Realtime extends Adapter
{ {
@ -140,7 +140,7 @@ class Realtime extends Adapter
$userId = array_key_exists('userId', $options) ? $options['userId'] : null; $userId = array_key_exists('userId', $options) ? $options['userId'] : null;
$redis = new \Redis(); //TODO: make this part of the constructor $redis = new \Redis(); //TODO: make this part of the constructor
$redis->connect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', '')); $redis->connect(System::getEnv('_APP_REDIS_HOST', ''), System::getEnv('_APP_REDIS_PORT', ''));
$redis->publish('realtime', json_encode([ $redis->publish('realtime', json_encode([
'project' => $projectId, 'project' => $projectId,
'roles' => $roles, 'roles' => $roles,

View file

@ -4,7 +4,6 @@ namespace Appwrite\Migration;
use Exception; use Exception;
use Swoole\Runtime; use Swoole\Runtime;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Database\Database; use Utopia\Database\Database;
@ -12,6 +11,7 @@ use Utopia\Database\Document;
use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\ID;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization;
use Utopia\System\System;
Runtime::enableCoroutine(SWOOLE_HOOK_ALL); Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
@ -252,7 +252,7 @@ abstract class Migration
default => 'projects', default => 'projects',
}; };
if (!$this->projectDB->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), $name)) { if (!$this->projectDB->exists(System::getEnv('_APP_DB_SCHEMA', 'appwrite'), $name)) {
$attributes = []; $attributes = [];
$indexes = []; $indexes = [];
$collection = $this->collections[$collectionType][$id]; $collection = $this->collections[$collectionType][$id];

View file

@ -4,7 +4,6 @@ namespace Appwrite\Migration\Version;
use Appwrite\Migration\Migration; use Appwrite\Migration\Migration;
use Appwrite\OpenSSL\OpenSSL; use Appwrite\OpenSSL\OpenSSL;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Database\Database; use Utopia\Database\Database;
@ -12,6 +11,7 @@ use Utopia\Database\Document;
use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role; use Utopia\Database\Helpers\Role;
use Utopia\System\System;
class V15 extends Migration class V15 extends Migration
{ {
@ -1484,7 +1484,7 @@ class V15 extends Migration
*/ */
protected function encryptFilter(string $value): string protected function encryptFilter(string $value): string
{ {
$key = App::getEnv('_APP_OPENSSL_KEY_V1'); $key = System::getEnv('_APP_OPENSSL_KEY_V1');
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
$tag = null; $tag = null;

View file

@ -3,7 +3,6 @@
namespace Appwrite\Migration\Version; namespace Appwrite\Migration\Version;
use Appwrite\Migration\Migration; use Appwrite\Migration\Migration;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Database\Database; use Utopia\Database\Database;
@ -11,6 +10,7 @@ use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Exception; use Utopia\Database\Exception;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\System\System;
class V19 extends Migration class V19 extends Migration
{ {
@ -731,7 +731,7 @@ class V19 extends Migration
if (empty($document->getAttribute('scheduleId', null))) { if (empty($document->getAttribute('scheduleId', null))) {
$schedule = $this->consoleDB->createDocument('schedules', new Document([ $schedule = $this->consoleDB->createDocument('schedules', new Document([
'region' => App::getEnv('_APP_REGION', 'default'), // Todo replace with projects region 'region' => System::getEnv('_APP_REGION', 'default'), // Todo replace with projects region
'resourceType' => 'function', 'resourceType' => 'function',
'resourceId' => $document->getId(), 'resourceId' => $document->getId(),
'resourceInternalId' => $document->getInternalId(), 'resourceInternalId' => $document->getInternalId(),

View file

@ -4,7 +4,6 @@ namespace Appwrite\Platform\Tasks;
use League\Csv\Writer; use League\Csv\Writer;
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
use Utopia\App;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database; use Utopia\Database\Database;
@ -14,6 +13,7 @@ use Utopia\Database\Validator\Authorization;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\System\System;
use Utopia\Validator\Text; use Utopia\Validator\Text;
class CalcTierStats extends Action class CalcTierStats extends Action
@ -184,8 +184,8 @@ class CalcTierStats extends Action
try { try {
/** Addresses */ /** Addresses */
$mail->setFrom(App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), 'Appwrite Cloud Hamster'); $mail->setFrom(System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), 'Appwrite Cloud Hamster');
$recipients = explode(',', App::getEnv('_APP_USERS_STATS_RECIPIENTS', '')); $recipients = explode(',', System::getEnv('_APP_USERS_STATS_RECIPIENTS', ''));
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {
$mail->addAddress($recipient); $mail->addAddress($recipient);
} }

View file

@ -12,6 +12,7 @@ use Utopia\Platform\Action;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\Storage\Device\Local; use Utopia\Storage\Device\Local;
use Utopia\Storage\Storage; use Utopia\Storage\Storage;
use Utopia\System\System;
class Doctor extends Action class Doctor extends Action
{ {
@ -35,11 +36,11 @@ class Doctor extends Action
/ \ ) __/ ) __/\ /\ / ) / )( )( ) _) _ )(( O ) / \ ) __/ ) __/\ /\ / ) / )( )( ) _) _ )(( O )
\_/\_/(__) (__) (_/\_)(__\_)(__) (__) (____)(_)(__)\__/ "); \_/\_/(__) (__) (_/\_)(__\_)(__) (__) (____)(_)(__)\__/ ");
Console::log("\n" . '👩‍⚕️ Running ' . APP_NAME . ' Doctor for version ' . App::getEnv('_APP_VERSION', 'UNKNOWN') . ' ...' . "\n"); Console::log("\n" . '👩‍⚕️ Running ' . APP_NAME . ' Doctor for version ' . System::getEnv('_APP_VERSION', 'UNKNOWN') . ' ...' . "\n");
Console::log('[Settings]'); Console::log('[Settings]');
$domain = new Domain(App::getEnv('_APP_DOMAIN')); $domain = new Domain(System::getEnv('_APP_DOMAIN'));
if (!$domain->isKnown() || $domain->isTest()) { if (!$domain->isKnown() || $domain->isTest()) {
Console::log('🔴 Hostname has no public suffix (' . $domain->get() . ')'); Console::log('🔴 Hostname has no public suffix (' . $domain->get() . ')');
@ -47,7 +48,7 @@ class Doctor extends Action
Console::log('🟢 Hostname has a public suffix (' . $domain->get() . ')'); Console::log('🟢 Hostname has a public suffix (' . $domain->get() . ')');
} }
$domain = new Domain(App::getEnv('_APP_DOMAIN_TARGET')); $domain = new Domain(System::getEnv('_APP_DOMAIN_TARGET'));
if (!$domain->isKnown() || $domain->isTest()) { if (!$domain->isKnown() || $domain->isTest()) {
Console::log('🔴 CNAME target has no public suffix (' . $domain->get() . ')'); Console::log('🔴 CNAME target has no public suffix (' . $domain->get() . ')');
@ -55,27 +56,27 @@ class Doctor extends Action
Console::log('🟢 CNAME target has a public suffix (' . $domain->get() . ')'); Console::log('🟢 CNAME target has a public suffix (' . $domain->get() . ')');
} }
if (App::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(App::getEnv('_APP_OPENSSL_KEY_V1'))) { if (System::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(System::getEnv('_APP_OPENSSL_KEY_V1'))) {
Console::log('🔴 Not using a unique secret key for encryption'); Console::log('🔴 Not using a unique secret key for encryption');
} else { } else {
Console::log('🟢 Using a unique secret key for encryption'); Console::log('🟢 Using a unique secret key for encryption');
} }
if (App::getEnv('_APP_ENV', 'development') !== 'production') { if (System::getEnv('_APP_ENV', 'development') !== 'production') {
Console::log('🔴 App environment is set for development'); Console::log('🔴 App environment is set for development');
} else { } else {
Console::log('🟢 App environment is set for production'); Console::log('🟢 App environment is set for production');
} }
if ('enabled' !== App::getEnv('_APP_OPTIONS_ABUSE', 'disabled')) { if ('enabled' !== System::getEnv('_APP_OPTIONS_ABUSE', 'disabled')) {
Console::log('🔴 Abuse protection is disabled'); Console::log('🔴 Abuse protection is disabled');
} else { } else {
Console::log('🟢 Abuse protection is enabled'); Console::log('🟢 Abuse protection is enabled');
} }
$authWhitelistRoot = App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', null); $authWhitelistRoot = System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', null);
$authWhitelistEmails = App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null); $authWhitelistEmails = System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null);
$authWhitelistIPs = App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null); $authWhitelistIPs = System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null);
if ( if (
empty($authWhitelistRoot) empty($authWhitelistRoot)
@ -87,20 +88,20 @@ class Doctor extends Action
Console::log('🟢 Console access limits are enabled'); Console::log('🟢 Console access limits are enabled');
} }
if ('enabled' !== App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled')) { if ('enabled' !== System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled')) {
Console::log('🔴 HTTPS force option is disabled'); Console::log('🔴 HTTPS force option is disabled');
} else { } else {
Console::log('🟢 HTTPS force option is enabled'); Console::log('🟢 HTTPS force option is enabled');
} }
if ('enabled' !== App::getEnv('_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS', 'disabled')) { if ('enabled' !== System::getEnv('_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS', 'disabled')) {
Console::log('🔴 HTTPS force option is disabled for function domains'); Console::log('🔴 HTTPS force option is disabled for function domains');
} else { } else {
Console::log('🟢 HTTPS force option is enabled for function domains'); Console::log('🟢 HTTPS force option is enabled for function domains');
} }
$providerName = App::getEnv('_APP_LOGGING_PROVIDER', ''); $providerName = System::getEnv('_APP_LOGGING_PROVIDER', '');
$providerConfig = App::getEnv('_APP_LOGGING_CONFIG', ''); $providerConfig = System::getEnv('_APP_LOGGING_CONFIG', '');
if (empty($providerName) || empty($providerConfig) || !Logger::hasProvider($providerName)) { if (empty($providerName) || empty($providerConfig) || !Logger::hasProvider($providerName)) {
Console::log('🔴 Logging adapter is disabled'); Console::log('🔴 Logging adapter is disabled');
@ -162,11 +163,11 @@ class Doctor extends Action
} }
} }
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
try { try {
$antivirus = new Network( $antivirus = new Network(
App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), System::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310) (int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
); );
if ((@$antivirus->ping())) { if ((@$antivirus->ping())) {
@ -251,10 +252,10 @@ class Doctor extends Action
try { try {
if (App::isProduction()) { if (App::isProduction()) {
Console::log(''); Console::log('');
$version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost') . '/version'), true); $version = \json_decode(@\file_get_contents(System::getEnv('_APP_HOME', 'http://localhost') . '/version'), true);
if ($version && isset($version['version'])) { if ($version && isset($version['version'])) {
if (\version_compare($version['version'], App::getEnv('_APP_VERSION', 'UNKNOWN')) === 0) { if (\version_compare($version['version'], System::getEnv('_APP_VERSION', 'UNKNOWN')) === 0) {
Console::info('You are running the latest version of ' . APP_NAME . '! 🥳'); Console::info('You are running the latest version of ' . APP_NAME . '! 🥳');
} else { } else {
Console::info('A new version (' . $version['version'] . ') is available! 🥳' . "\n"); Console::info('A new version (' . $version['version'] . ') is available! 🥳' . "\n");

View file

@ -13,6 +13,7 @@ use Utopia\Database\Query;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\System\System;
class GetMigrationStats extends Action class GetMigrationStats extends Action
{ {
@ -164,8 +165,8 @@ class GetMigrationStats extends Action
try { try {
/** Addresses */ /** Addresses */
$mail->setFrom(App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), 'Appwrite Cloud Hamster'); $mail->setFrom(System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), 'Appwrite Cloud Hamster');
$recipients = explode(',', App::getEnv('_APP_USERS_STATS_RECIPIENTS', '')); $recipients = explode(',', System::getEnv('_APP_USERS_STATS_RECIPIENTS', ''));
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {
$mail->addAddress($recipient); $mail->addAddress($recipient);

View file

@ -3,12 +3,12 @@
namespace Appwrite\Platform\Tasks; namespace Appwrite\Platform\Tasks;
use Appwrite\Event\Hamster as EventHamster; use Appwrite\Event\Hamster as EventHamster;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database; use Utopia\Database\Database;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\System\System;
class Hamster extends Action class Hamster extends Action
{ {
@ -33,9 +33,9 @@ class Hamster extends Action
Console::title('Cloud Hamster V1'); Console::title('Cloud Hamster V1');
Console::success(APP_NAME . ' cloud hamster process has started'); Console::success(APP_NAME . ' cloud hamster process has started');
$sleep = (int) App::getEnv('_APP_HAMSTER_INTERVAL', '30'); // 30 seconds (by default) $sleep = (int) System::getEnv('_APP_HAMSTER_INTERVAL', '30'); // 30 seconds (by default)
$jobInitTime = App::getEnv('_APP_HAMSTER_TIME', '22:00'); // (hour:minutes) $jobInitTime = System::getEnv('_APP_HAMSTER_TIME', '22:00'); // (hour:minutes)
$now = new \DateTime(); $now = new \DateTime();
$now->setTimezone(new \DateTimeZone(date_default_timezone_get())); $now->setTimezone(new \DateTimeZone(date_default_timezone_get()));

View file

@ -4,13 +4,13 @@ namespace Appwrite\Platform\Tasks;
use Appwrite\Event\Certificate; use Appwrite\Event\Certificate;
use Appwrite\Event\Delete; use Appwrite\Event\Delete;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database; use Utopia\Database\Database;
use Utopia\Database\DateTime; use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\System\System;
class Maintenance extends Action class Maintenance extends Action
{ {
@ -35,11 +35,11 @@ class Maintenance extends Action
Console::success(APP_NAME . ' maintenance process v1 has started'); Console::success(APP_NAME . ' maintenance process v1 has started');
// # of days in seconds (1 day = 86400s) // # of days in seconds (1 day = 86400s)
$interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); $interval = (int) System::getEnv('_APP_MAINTENANCE_INTERVAL', '86400');
$delay = (int) App::getEnv('_APP_MAINTENANCE_DELAY', '0'); $delay = (int) System::getEnv('_APP_MAINTENANCE_DELAY', '0');
$usageStatsRetentionHourly = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_USAGE_HOURLY', '8640000'); //100 days $usageStatsRetentionHourly = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_USAGE_HOURLY', '8640000'); //100 days
$cacheRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_CACHE', '2592000'); // 30 days $cacheRetention = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_CACHE', '2592000'); // 30 days
$schedulesDeletionRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_SCHEDULES', '86400'); // 1 Day $schedulesDeletionRetention = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_SCHEDULES', '86400'); // 1 Day
Console::loop(function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForConsole, $queueForDeletes, $queueForCertificates) { Console::loop(function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForConsole, $queueForDeletes, $queueForCertificates) {
$time = DateTime::now(); $time = DateTime::now();

View file

@ -3,10 +3,10 @@
namespace Appwrite\Platform\Tasks; namespace Appwrite\Platform\Tasks;
use Appwrite\Event\Certificate; use Appwrite\Event\Certificate;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\System\System;
use Utopia\Validator\Boolean; use Utopia\Validator\Boolean;
use Utopia\Validator\Hostname; use Utopia\Validator\Hostname;
@ -21,7 +21,7 @@ class SSL extends Action
{ {
$this $this
->desc('Validate server certificates') ->desc('Validate server certificates')
->param('domain', App::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true) ->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true)
->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true) ->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true)
->inject('queueForCertificates') ->inject('queueForCertificates')
->callback(fn (string $domain, bool|string $skipCheck, Certificate $queueForCertificates) => $this->action($domain, $skipCheck, $queueForCertificates)); ->callback(fn (string $domain, bool|string $skipCheck, Certificate $queueForCertificates) => $this->action($domain, $skipCheck, $queueForCertificates));

View file

@ -3,7 +3,6 @@
namespace Appwrite\Platform\Tasks; namespace Appwrite\Platform\Tasks;
use Swoole\Timer; use Swoole\Timer;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database; use Utopia\Database\Database;
use Utopia\Database\DateTime; use Utopia\Database\DateTime;
@ -12,6 +11,7 @@ use Utopia\Database\Exception;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Pools\Group; use Utopia\Pools\Group;
use Utopia\System\System;
use function Swoole\Coroutine\run; use function Swoole\Coroutine\run;
@ -99,7 +99,7 @@ abstract class ScheduleBase extends Action
} }
$results = $dbForConsole->find('schedules', \array_merge($paginationQueries, [ $results = $dbForConsole->find('schedules', \array_merge($paginationQueries, [
Query::equal('region', [App::getEnv('_APP_REGION', 'default')]), Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::equal('resourceType', [static::getSupportedResource()]), Query::equal('resourceType', [static::getSupportedResource()]),
Query::equal('active', [true]), Query::equal('active', [true]),
])); ]));
@ -153,7 +153,7 @@ abstract class ScheduleBase extends Action
} }
$results = $dbForConsole->find('schedules', \array_merge($paginationQueries, [ $results = $dbForConsole->find('schedules', \array_merge($paginationQueries, [
Query::equal('region', [App::getEnv('_APP_REGION', 'default')]), Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::equal('resourceType', [static::getSupportedResource()]), Query::equal('resourceType', [static::getSupportedResource()]),
Query::greaterThanEqual('resourceUpdatedAt', $lastSyncUpdate), Query::greaterThanEqual('resourceUpdatedAt', $lastSyncUpdate),
])); ]));

View file

@ -18,6 +18,7 @@ use Utopia\Database\Database;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Registry\Registry; use Utopia\Registry\Registry;
use Utopia\Request; use Utopia\Request;
use Utopia\System\System;
use Utopia\Validator\Text; use Utopia\Validator\Text;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
@ -257,8 +258,8 @@ class Specs extends Action
}; };
$specs = new Specification($formatInstance); $specs = new Specification($formatInstance);
$endpoint = App::getEnv('_APP_HOME', '[HOSTNAME]'); $endpoint = System::getEnv('_APP_HOME', '[HOSTNAME]');
$email = App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $email = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM);
$formatInstance $formatInstance
->setParam('name', APP_NAME) ->setParam('name', APP_NAME)

View file

@ -2,10 +2,10 @@
namespace Appwrite\Platform\Tasks; namespace Appwrite\Platform\Tasks;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\System\System;
class Vars extends Action class Vars extends Action
{ {
@ -33,7 +33,7 @@ class Vars extends Action
} }
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
Console::log('- ' . $value['name'] . '=' . App::getEnv($value['name'], '')); Console::log('- ' . $value['name'] . '=' . System::getEnv($value['name'], ''));
} }
} }
} }

View file

@ -2,9 +2,9 @@
namespace Appwrite\Platform\Tasks; namespace Appwrite\Platform\Tasks;
use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\System\System;
class Version extends Action class Version extends Action
{ {
@ -18,7 +18,7 @@ class Version extends Action
$this $this
->desc('Get the server version') ->desc('Get the server version')
->callback(function () { ->callback(function () {
Console::log(App::getEnv('_APP_VERSION', 'UNKNOWN')); Console::log(System::getEnv('_APP_VERSION', 'UNKNOWN'));
}); });
} }
} }

View file

@ -10,7 +10,6 @@ use Appwrite\Utopia\Response\Model\Deployment;
use Appwrite\Vcs\Comment; use Appwrite\Vcs\Comment;
use Executor\Executor; use Executor\Executor;
use Swoole\Coroutine as Co; use Swoole\Coroutine as Co;
use Utopia\App;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
@ -27,6 +26,7 @@ use Utopia\Platform\Action;
use Utopia\Queue\Message; use Utopia\Queue\Message;
use Utopia\Storage\Device; use Utopia\Storage\Device;
use Utopia\Storage\Device\Local; use Utopia\Storage\Device\Local;
use Utopia\System\System;
use Utopia\VCS\Adapter\Git\GitHub; use Utopia\VCS\Adapter\Git\GitHub;
class Builds extends Action class Builds extends Action
@ -117,7 +117,7 @@ class Builds extends Action
*/ */
protected function buildDeployment(Device $deviceForFunctions, Func $queueForFunctions, Event $queueForEvents, Usage $queueForUsage, Database $dbForConsole, Database $dbForProject, GitHub $github, Document $project, Document $function, Document $deployment, Document $template, Log $log): void protected function buildDeployment(Device $deviceForFunctions, Func $queueForFunctions, Event $queueForEvents, Usage $queueForUsage, Database $dbForConsole, Database $dbForProject, GitHub $github, Document $project, Document $function, Document $deployment, Document $template, Log $log): void
{ {
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $executor = new Executor(System::getEnv('_APP_EXECUTOR_HOST'));
$functionId = $function->getId(); $functionId = $function->getId();
$log->addTag('functionId', $function->getId()); $log->addTag('functionId', $function->getId());
@ -195,8 +195,8 @@ class Builds extends Action
if ($isVcsEnabled) { if ($isVcsEnabled) {
$installation = $dbForConsole->getDocument('installations', $installationId); $installation = $dbForConsole->getDocument('installations', $installationId);
$providerInstallationId = $installation->getAttribute('providerInstallationId'); $providerInstallationId = $installation->getAttribute('providerInstallationId');
$privateKey = App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = App::getEnv('_APP_VCS_GITHUB_APP_ID'); $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
$github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId);
} }
@ -304,7 +304,7 @@ class Builds extends Action
} }
$directorySize = $localDevice->getDirectorySize($tmpDirectory); $directorySize = $localDevice->getDirectorySize($tmpDirectory);
$functionsSizeLimit = (int) App::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', '30000000'); $functionsSizeLimit = (int) System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', '30000000');
if ($directorySize > $functionsSizeLimit) { if ($directorySize > $functionsSizeLimit) {
throw new \Exception('Repository directory size should be less than ' . number_format($functionsSizeLimit / 1048576, 2) . ' MBs.'); throw new \Exception('Repository directory size should be less than ' . number_format($functionsSizeLimit / 1048576, 2) . ' MBs.');
} }
@ -593,8 +593,8 @@ class Builds extends Action
$name = "{$functionName} ({$projectName})"; $name = "{$functionName} ({$projectName})";
$protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = App::getEnv('_APP_DOMAIN'); $hostname = System::getEnv('_APP_DOMAIN');
$functionId = $function->getId(); $functionId = $function->getId();
$projectId = $project->getId(); $projectId = $project->getId();
$providerTargetUrl = $protocol . '://' . $hostname . "/console/project-$projectId/functions/function-$functionId"; $providerTargetUrl = $protocol . '://' . $hostname . "/console/project-$projectId/functions/function-$functionId";

View file

@ -26,6 +26,7 @@ use Utopia\Locale\Locale;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Queue\Message; use Utopia\Queue\Message;
use Utopia\System\System;
class Certificates extends Action class Certificates extends Action
{ {
@ -134,7 +135,7 @@ class Certificates extends Action
try { try {
// Email for alerts is required by LetsEncrypt // Email for alerts is required by LetsEncrypt
$email = App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'); $email = System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS');
if (empty($email)) { if (empty($email)) {
throw new Exception('You must set a valid security email address (_APP_SYSTEM_SECURITY_EMAIL_ADDRESS) to issue an SSL certificate.'); throw new Exception('You must set a valid security email address (_APP_SYSTEM_SECURITY_EMAIL_ADDRESS) to issue an SSL certificate.');
} }
@ -235,7 +236,7 @@ class Certificates extends Action
*/ */
private function getMainDomain(): ?string private function getMainDomain(): ?string
{ {
$envDomain = App::getEnv('_APP_DOMAIN', ''); $envDomain = System::getEnv('_APP_DOMAIN', '');
if (!empty($envDomain) && $envDomain !== 'localhost') { if (!empty($envDomain) && $envDomain !== 'localhost') {
return $envDomain; return $envDomain;
} }
@ -267,7 +268,7 @@ class Certificates extends Action
if (!$isMainDomain) { if (!$isMainDomain) {
// TODO: Would be awesome to also support A/AAAA records here. Maybe dry run? // TODO: Would be awesome to also support A/AAAA records here. Maybe dry run?
// Validate if domain target is properly configured // Validate if domain target is properly configured
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', '')); $target = new Domain(System::getEnv('_APP_DOMAIN_TARGET', ''));
if (!$target->isKnown() || $target->isTest()) { if (!$target->isKnown() || $target->isTest()) {
throw new Exception('Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.'); throw new Exception('Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.');
@ -436,7 +437,7 @@ class Certificates extends Action
// Log error into console // Log error into console
Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage); Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage);
$locale = new Locale(App::getEnv('_APP_LOCALE', 'en')); $locale = new Locale(System::getEnv('_APP_LOCALE', 'en'));
// Send mail to administratore mail // Send mail to administratore mail
$template = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-certificate-failed.tpl'); $template = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-certificate-failed.tpl');
@ -473,7 +474,7 @@ class Certificates extends Action
->setBody($body) ->setBody($body)
->setName('Appwrite Administrator') ->setName('Appwrite Administrator')
->setVariables($emailVariables) ->setVariables($emailVariables)
->setRecipient(App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS')) ->setRecipient(System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'))
->trigger(); ->trigger();
} }

View file

@ -8,7 +8,6 @@ use Executor\Executor;
use Throwable; use Throwable;
use Utopia\Abuse\Abuse; use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\TimeLimit; use Utopia\Abuse\Adapters\TimeLimit;
use Utopia\App;
use Utopia\Audit\Audit; use Utopia\Audit\Audit;
use Utopia\Cache\Adapter\Filesystem; use Utopia\Cache\Adapter\Filesystem;
use Utopia\Cache\Cache; use Utopia\Cache\Cache;
@ -26,6 +25,7 @@ use Utopia\Logger\Log;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Queue\Message; use Utopia\Queue\Message;
use Utopia\Storage\Device; use Utopia\Storage\Device;
use Utopia\System\System;
class Deletes extends Action class Deletes extends Action
{ {
@ -180,7 +180,7 @@ class Deletes extends Action
$this->listByGroup( $this->listByGroup(
'schedules', 'schedules',
[ [
Query::equal('region', [App::getEnv('_APP_REGION', 'default')]), Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::lessThanEqual('resourceUpdatedAt', $datetime), Query::lessThanEqual('resourceUpdatedAt', $datetime),
Query::equal('active', [false]), Query::equal('active', [false]),
], ],
@ -1083,7 +1083,7 @@ class Deletes extends Action
*/ */
private function deleteRuntimes(callable $getProjectDB, ?Document $function, Document $project): void private function deleteRuntimes(callable $getProjectDB, ?Document $function, Document $project): void
{ {
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $executor = new Executor(System::getEnv('_APP_EXECUTOR_HOST'));
$deleteByFunction = function (Document $function) use ($getProjectDB, $project, $executor) { $deleteByFunction = function (Document $function) use ($getProjectDB, $project, $executor) {
$this->listByGroup( $this->listByGroup(

Some files were not shown because too many files have changed in this diff Show more