Add domain_enabled var

This commit is contained in:
Matej Bačo
2023-08-28 16:08:50 +02:00
parent f130a9ebc9
commit d4acbcf4f0
4 changed files with 14 additions and 3 deletions
+5
View File
@@ -29,6 +29,10 @@ App::get('/v1/console/variables')
->label('sdk.response.model', Response::MODEL_CONSOLE_VARIABLES)
->inject('response')
->action(function (Response $response) {
$isDomainEnabled = !empty(App::getEnv('_APP_DOMAIN', ''))
&& !empty(App::getEnv('_APP_DOMAIN_TARGET', ''))
&& App::getEnv('_APP_DOMAIN', '') !== 'localhost'
&& App::getEnv('_APP_DOMAIN_TARGET', '') !== 'localhost';
$isVcsEnabled = !empty(App::getEnv('_APP_VCS_GITHUB_APP_NAME', ''))
&& !empty(App::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY', ''))
@@ -44,6 +48,7 @@ App::get('/v1/console/variables')
'_APP_FUNCTIONS_SIZE_LIMIT' => +App::getEnv('_APP_FUNCTIONS_SIZE_LIMIT'),
'_APP_USAGE_STATS' => App::getEnv('_APP_USAGE_STATS'),
'_APP_VCS_ENABLED' => $isVcsEnabled,
'_APP_DOMAIN_ENABLED' => $isDomainEnabled,
'_APP_ASSISTANT_ENABLED' => $isAssistantEnabled
]);
+2 -2
View File
@@ -1521,7 +1521,7 @@ App::patch('/v1/projects/:projectId/smtp')
->label('sdk.response.model', Response::MODEL_PROJECT)
->param('projectId', '', new UID(), 'Project unique ID.')
->param('enabled', false, new Boolean(), 'Enable custom SMTP service')
->param('senderName', '', new Text(255), 'Name of the email sender', true)
->param('senderName', '', new Text(255, 0), 'Name of the email sender', true)
->param('senderEmail', '', new Email(), 'Email of the sender', true)
->param('replyTo', '', new Email(), 'Reply to email', true)
->param('host', '', new HostName(), 'SMTP server host name', true)
@@ -1753,7 +1753,7 @@ App::patch('/v1/projects/:projectId/templates/email/:type/:locale')
->param('locale', '', fn ($localeCodes) => new WhiteList($localeCodes), 'Template locale', false, ['localeCodes'])
->param('subject', '', new Text(255), 'Email Subject')
->param('message', '', new Text(0), 'Template message')
->param('senderName', '', new Text(255), 'Name of the email sender', true)
->param('senderName', '', new Text(255, 0), 'Name of the email sender', true)
->param('senderEmail', '', new Email(), 'Email of the sender', true)
->param('replyTo', '', new Email(), 'Reply to email', true)
->inject('response')
@@ -40,6 +40,12 @@ class ConsoleVariables extends Model
'default' => false,
'example' => true,
])
->addRule('_APP_DOMAIN_ENABLED', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Defines if main domain is configured. If so, custom domains can be created.',
'default' => false,
'example' => true,
])
->addRule('_APP_ASSISTANT_ENABLED', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Defines if AI assistant is enabled.',