From 5edb1f688a97f2f3f957d7c676eb81a906fb087e Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 21 May 2025 13:39:02 +0530 Subject: [PATCH] add: stripe key management to backend as well. --- .env | 1 + app/controllers/api/console.php | 3 +- .../Response/Model/ConsoleVariables.php | 87 +++++++++---------- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/.env b/.env index 2e89dc2d5e..350171386e 100644 --- a/.env +++ b/.env @@ -22,6 +22,7 @@ _APP_OPTIONS_FORCE_HTTPS=disabled _APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled _APP_OPENSSL_KEY_V1=your-secret-key _APP_DOMAIN=traefik +_APP_STRIPE_KEY= _APP_SUPPORTS_MULTI_REGION=false _APP_DOMAIN_FUNCTIONS=functions.localhost _APP_DOMAIN_SITES=sites.localhost diff --git a/app/controllers/api/console.php b/app/controllers/api/console.php index 7eb99af6db..2f88e1ddcb 100644 --- a/app/controllers/api/console.php +++ b/app/controllers/api/console.php @@ -81,7 +81,8 @@ App::get('/v1/console/variables') '_APP_DOMAIN_FUNCTIONS' => System::getEnv('_APP_DOMAIN_FUNCTIONS'), '_APP_OPTIONS_FORCE_HTTPS' => System::getEnv('_APP_OPTIONS_FORCE_HTTPS'), '_APP_DOMAINS_NAMESERVERS' => System::getEnv('_APP_DOMAINS_NAMESERVERS'), - '_APP_SUPPORTS_MULTI_REGION' => System::getEnv('_APP_SUPPORTS_MULTI_REGION') + '_APP_SUPPORTS_MULTI_REGION' => System::getEnv('_APP_SUPPORTS_MULTI_REGION'), + '_APP_STRIPE_KEY' => System::getEnv('_APP_STRIPE_KEY') ]); $response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES); diff --git a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php index 450b1aead0..a1f55cd62f 100644 --- a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php +++ b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php @@ -10,24 +10,24 @@ class ConsoleVariables extends Model public function __construct() { $this - ->addRule('_APP_DOMAIN_TARGET_CNAME', [ - 'type' => self::TYPE_STRING, - 'description' => 'CNAME target for your Appwrite custom domains.', - 'default' => '', - 'example' => 'appwrite.io', - ]) - ->addRule('_APP_DOMAIN_TARGET_A', [ - 'type' => self::TYPE_STRING, - 'description' => 'A target for your Appwrite custom domains.', - 'default' => '', - 'example' => '127.0.0.1', - ]) - ->addRule('_APP_DOMAIN_TARGET_AAAA', [ - 'type' => self::TYPE_STRING, - 'description' => 'AAAA target for your Appwrite custom domains.', - 'default' => '', - 'example' => '::1', - ]) + ->addRule('_APP_DOMAIN_TARGET_CNAME', [ + 'type' => self::TYPE_STRING, + 'description' => 'CNAME target for your Appwrite custom domains.', + 'default' => '', + 'example' => 'appwrite.io', + ]) + ->addRule('_APP_DOMAIN_TARGET_A', [ + 'type' => self::TYPE_STRING, + 'description' => 'A target for your Appwrite custom domains.', + 'default' => '', + 'example' => '127.0.0.1', + ]) + ->addRule('_APP_DOMAIN_TARGET_AAAA', [ + 'type' => self::TYPE_STRING, + 'description' => 'AAAA target for your Appwrite custom domains.', + 'default' => '', + 'example' => '::1', + ]) ->addRule('_APP_STORAGE_LIMIT', [ 'type' => self::TYPE_INTEGER, 'description' => 'Maximum file size allowed for file upload in bytes.', @@ -76,33 +76,30 @@ class ConsoleVariables extends Model 'default' => '', 'example' => 'functions.localhost', ]) - ->addRule( - '_APP_OPTIONS_FORCE_HTTPS', - [ - 'type' => self::TYPE_STRING, - 'description' => 'Defines if HTTPS is enforced for all requests.', - 'default' => '', - 'example' => 'enabled', - ] - ) - ->addRule( - '_APP_DOMAINS_NAMESERVERS', - [ - 'type' => self::TYPE_STRING, - 'description' => 'Comma-separated list of nameservers.', - 'default' => '', - 'example' => 'ns1.example.com,ns2.example.com', - ] - ) - ->addRule( - '_APP_SUPPORTS_MULTI_REGION', - [ - 'type' => self::TYPE_BOOLEAN, - 'description' => 'Defines if multi-region is supported.', - 'default' => false, - 'example' => true, - ] - ); + ->addRule('_APP_OPTIONS_FORCE_HTTPS', [ + 'type' => self::TYPE_STRING, + 'description' => 'Defines if HTTPS is enforced for all requests.', + 'default' => '', + 'example' => 'enabled', + ]) + ->addRule('_APP_DOMAINS_NAMESERVERS', [ + 'type' => self::TYPE_STRING, + 'description' => 'Comma-separated list of nameservers.', + 'default' => '', + 'example' => 'ns1.example.com,ns2.example.com', + ]) + ->addRule('_APP_SUPPORTS_MULTI_REGION', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Defines if multi-region is supported.', + 'default' => false, + 'example' => true, + ]) + ->addRule('_APP_STRIPE_KEY', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Defines stripe live/test key.', + 'default' => '', + 'example' => 'sk_test_51H8xx0A9aBcDeFGhiJklMNopQrStuVwXyZ1234567890abcdefGhIjKlMnOpQr', + ]); } /**