diff --git a/app/config/services.php b/app/config/services.php
index e0d5e263f..eeabbc21d 100644
--- a/app/config/services.php
+++ b/app/config/services.php
@@ -186,4 +186,17 @@ return [
'optional' => true,
'icon' => '/images/services/graphql.png',
],
+ 'console' => [
+ 'key' => 'console',
+ 'name' => 'Conosle',
+ 'subtitle' => 'The Console service allows you to interact with Console relevant informations.',
+ 'description' => '',
+ 'controller' => 'api/console.php',
+ 'sdk' => true,
+ 'docs' => true,
+ 'docsUrl' => '',
+ 'tests' => false,
+ 'optional' => false,
+ 'icon' => '',
+ ],
];
diff --git a/app/controllers/api/console.php b/app/controllers/api/console.php
new file mode 100644
index 000000000..eb9bab1fb
--- /dev/null
+++ b/app/controllers/api/console.php
@@ -0,0 +1,40 @@
+groups(['console'])
+ ->inject('console')
+ ->action(function (Document $project) {
+ if ($project->getId() !== 'console') {
+ throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN);
+ }
+ });
+
+
+App::get('/v1/console/variables')
+ ->desc('Get Variables')
+ ->groups(['api', 'projects'])
+ ->label('scope', 'projects.read')
+ ->label('sdk.auth', [APP_AUTH_TYPE_KEY])
+ ->label('sdk.namespace', 'console')
+ ->label('sdk.method', 'variables')
+ ->label('sdk.description', '/docs/references/console/variables.md')
+ ->label('sdk.response.code', Response::STATUS_CODE_OK)
+ ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
+ ->label('sdk.response.model', Response::MODEL_CONSOLE_VARIABLES)
+ ->inject('response')
+ ->action(function (Response $response) {
+
+ $variables = new Document([
+ '_APP_DOMAIN_TARGET' => App::getEnv('_APP_DOMAIN_TARGET'),
+ '_APP_STORAGE_LIMIT' => +App::getEnv('_APP_STORAGE_LIMIT'),
+ '_APP_FUNCTIONS_SIZE_LIMIT' => +App::getEnv('_APP_FUNCTIONS_SIZE_LIMIT'),
+ '_APP_USAGE_STATS' => App::getEnv('_APP_USAGE_STATS'),
+ ]);
+
+ $response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES);
+ });
diff --git a/docs/references/console/variables.md b/docs/references/console/variables.md
new file mode 100644
index 000000000..ddfa2b9b7
--- /dev/null
+++ b/docs/references/console/variables.md
@@ -0,0 +1 @@
+Get all Environment Variables that are relevant for the console.
\ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
index 5b4bcdb99..f83f9f0fa 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -20,6 +20,7 @@
./tests/e2e/General
./tests/e2e/Scopes
./tests/e2e/Services/Account
+ ./tests/e2e/Services/Console
./tests/e2e/Services/Realtime
./tests/e2e/Services/Avatars
./tests/e2e/Services/Databases
diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php
index 2ab514f91..1f69dbb77 100644
--- a/src/Appwrite/Utopia/Response.php
+++ b/src/Appwrite/Utopia/Response.php
@@ -44,6 +44,7 @@ use Appwrite\Utopia\Response\Model\Execution;
use Appwrite\Utopia\Response\Model\Build;
use Appwrite\Utopia\Response\Model\File;
use Appwrite\Utopia\Response\Model\Bucket;
+use Appwrite\Utopia\Response\Model\ConsoleVariables;
use Appwrite\Utopia\Response\Model\Func;
use Appwrite\Utopia\Response\Model\Index;
use Appwrite\Utopia\Response\Model\JWT;
@@ -213,6 +214,9 @@ class Response extends SwooleResponse
public const MODEL_HEALTH_TIME = 'healthTime';
public const MODEL_HEALTH_ANTIVIRUS = 'healthAntivirus';
+ // Console
+ public const MODEL_CONSOLE_VARIABLES = 'consoleVariables';
+
// Deprecated
public const MODEL_PERMISSIONS = 'permissions';
public const MODEL_RULE = 'rule';
@@ -341,6 +345,7 @@ class Response extends SwooleResponse
->setModel(new UsageFunctions())
->setModel(new UsageFunction())
->setModel(new UsageProject())
+ ->setModel(new ConsoleVariables())
// Verification
// Recovery
// Tests (keep last)
diff --git a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php
new file mode 100644
index 000000000..98d3409fb
--- /dev/null
+++ b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php
@@ -0,0 +1,58 @@
+addRule('_APP_DOMAIN_TARGET', [
+ 'type' => self::TYPE_STRING,
+ 'description' => 'CNAME target for your Appwrite custom domains.',
+ 'default' => '',
+ 'example' => '1.3.0',
+ ])
+ ->addRule('_APP_STORAGE_LIMIT', [
+ 'type' => self::TYPE_INTEGER,
+ 'description' => 'Maximum file size allowed for file upload in bytes.',
+ 'default' => '',
+ 'example' => '1.3.0',
+ ])
+ ->addRule('_APP_FUNCTIONS_SIZE_LIMIT', [
+ 'type' => self::TYPE_INTEGER,
+ 'description' => 'Maximum file size allowed for deployment in bytes.',
+ 'default' => '',
+ 'example' => '1.3.0',
+ ])
+ ->addRule('_APP_USAGE_STATS', [
+ 'type' => self::TYPE_STRING,
+ 'description' => 'Defines if usage stats are enabled. This value is set to \'enabled\' by default, to disable the usage stats set the value to \'disabled\'.',
+ 'default' => '',
+ 'example' => '1.3.0',
+ ]);
+ }
+
+ /**
+ * Get Name
+ *
+ * @return string
+ */
+ public function getName(): string
+ {
+ return 'Console Variables';
+ }
+
+ /**
+ * Get Type
+ *
+ * @return string
+ */
+ public function getType(): string
+ {
+ return Response::MODEL_CONSOLE_VARIABLES;
+ }
+}
diff --git a/tests/e2e/Services/Console/ConsoleBase.php b/tests/e2e/Services/Console/ConsoleBase.php
new file mode 100644
index 000000000..e7d2eabd0
--- /dev/null
+++ b/tests/e2e/Services/Console/ConsoleBase.php
@@ -0,0 +1,7 @@
+client->call(Client::METHOD_GET, '/console/variables', array_merge([
+ 'content-type' => 'application/json',
+ 'x-appwrite-project' => $this->getProject()['$id'],
+ ], $this->getHeaders()), []);
+
+ $this->assertEquals(200, $response['headers']['status-code']);
+ $this->assertCount(4, $response['body']);
+ $this->assertIsString($response['body']['_APP_DOMAIN_TARGET']);
+ $this->assertIsInt($response['body']['_APP_STORAGE_LIMIT']);
+ $this->assertIsInt($response['body']['_APP_FUNCTIONS_SIZE_LIMIT']);
+ $this->assertIsString($response['body']['_APP_DOMAIN_TARGET']);
+ }
+}
diff --git a/tests/e2e/Services/Console/ConsoleCustomClientTest.php b/tests/e2e/Services/Console/ConsoleCustomClientTest.php
new file mode 100644
index 000000000..4b78b7f43
--- /dev/null
+++ b/tests/e2e/Services/Console/ConsoleCustomClientTest.php
@@ -0,0 +1,27 @@
+client->call(Client::METHOD_GET, '/console/variables', array_merge([
+ 'content-type' => 'application/json',
+ 'x-appwrite-project' => $this->getProject()['$id'],
+ ], $this->getHeaders()), []);
+
+ $this->assertEquals(401, $response['headers']['status-code']);
+ }
+}
diff --git a/tests/e2e/Services/Console/ConsoleCustomServerTest.php b/tests/e2e/Services/Console/ConsoleCustomServerTest.php
new file mode 100644
index 000000000..3748bbe54
--- /dev/null
+++ b/tests/e2e/Services/Console/ConsoleCustomServerTest.php
@@ -0,0 +1,27 @@
+client->call(Client::METHOD_GET, '/console/variables', array_merge([
+ 'content-type' => 'application/json',
+ 'x-appwrite-project' => $this->getProject()['$id'],
+ ], $this->getHeaders()), []);
+
+ $this->assertEquals(401, $response['headers']['status-code']);
+ }
+}