PR review changes
This commit is contained in:
parent
8655d71a67
commit
743c214a66
8 changed files with 30 additions and 62 deletions
|
@ -63,9 +63,9 @@ return [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => '_APP_DOMAIN_FUNCTIONS',
|
'name' => '_APP_DOMAIN_FUNCTIONS',
|
||||||
'description' => 'A domain to use for function preview URLs. Setting to "disabled" turns off function preview URLs.',
|
'description' => 'A domain to use for function preview URLs. Setting to empty turns off function preview URLs.',
|
||||||
'introduction' => '',
|
'introduction' => '',
|
||||||
'default' => 'disabled',
|
'default' => '',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'question' => '',
|
'question' => '',
|
||||||
'filter' => ''
|
'filter' => ''
|
||||||
|
|
|
@ -225,8 +225,8 @@ App::post('/v1/functions')
|
||||||
$redeployVcsLogic($request, $function, $project, $installation, $dbForProject, $template);
|
$redeployVcsLogic($request, $function, $project, $installation, $dbForProject, $template);
|
||||||
}
|
}
|
||||||
|
|
||||||
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS', 'disabled');
|
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS', '');
|
||||||
if ($functionsDomain !== 'disabled') {
|
if (!empty($functionsDomain)) {
|
||||||
$ruleId = ID::unique();
|
$ruleId = ID::unique();
|
||||||
$routeSubdomain = ID::unique();
|
$routeSubdomain = ID::unique();
|
||||||
$domain = "{$routeSubdomain}.{$functionsDomain}";
|
$domain = "{$routeSubdomain}.{$functionsDomain}";
|
||||||
|
@ -1814,11 +1814,10 @@ App::get('/v1/functions/:functionId/variables/:variableId')
|
||||||
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || $variable->getAttribute('resourceType') !== 'function') {
|
||||||
Query::equal('resourceInternalId', [$function->getInternalId()]),
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
Query::equal('resourceType', ['function']),
|
}
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
if ($variable === false || $variable->isEmpty()) {
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
|
@ -1856,11 +1855,10 @@ App::put('/v1/functions/:functionId/variables/:variableId')
|
||||||
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || $variable->getAttribute('resourceType') !== 'function') {
|
||||||
Query::equal('resourceInternalId', [$function->getInternalId()]),
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
Query::equal('resourceType', ['function']),
|
}
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
if ($variable === false || $variable->isEmpty()) {
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
|
@ -1916,11 +1914,10 @@ App::delete('/v1/functions/:functionId/variables/:variableId')
|
||||||
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || $variable->getAttribute('resourceType') !== 'function') {
|
||||||
Query::equal('resourceInternalId', [$function->getInternalId()]),
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
Query::equal('resourceType', ['function']),
|
}
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
if ($variable === false || $variable->isEmpty()) {
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
|
|
|
@ -216,14 +216,11 @@ App::get('/v1/project/variables/:variableId')
|
||||||
->label('sdk.response.model', Response::MODEL_VARIABLE)
|
->label('sdk.response.model', Response::MODEL_VARIABLE)
|
||||||
->param('variableId', '', new UID(), 'Variable unique ID.', false)
|
->param('variableId', '', new UID(), 'Variable unique ID.', false)
|
||||||
->inject('response')
|
->inject('response')
|
||||||
|
->inject('project')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->action(function (string $variableId, Response $response, Database $dbForProject) {
|
->action(function (string $variableId, Response $response, Document $project, Database $dbForProject) {
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceType') !== 'project') {
|
||||||
Query::equal('resourceType', ['project']),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,12 +245,8 @@ App::put('/v1/project/variables/:variableId')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->action(function (string $variableId, string $key, ?string $value, Document $project, Response $response, Database $dbForProject) {
|
->action(function (string $variableId, string $key, ?string $value, Document $project, Response $response, Database $dbForProject) {
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceType') !== 'project') {
|
||||||
Query::equal('resourceType', ['project']),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,12 +289,8 @@ App::delete('/v1/project/variables/:variableId')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->action(function (string $variableId, Document $project, Response $response, Database $dbForProject) {
|
->action(function (string $variableId, Document $project, Response $response, Database $dbForProject) {
|
||||||
$variable = $dbForProject->findOne('variables', [
|
$variable = $dbForProject->getDocument('variables', $variableId);
|
||||||
Query::equal('$id', [$variableId]),
|
if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceType') !== 'project') {
|
||||||
Query::equal('resourceType', ['project']),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($variable === false || $variable->isEmpty()) {
|
|
||||||
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
throw new Exception(Exception::VARIABLE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ App::post('/v1/proxy/rules')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$status = 'created';
|
$status = 'created';
|
||||||
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS', 'disabled');
|
$functionsDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS');
|
||||||
if ($functionsDomain !== 'disabled' && \str_ends_with($domain->get(), $functionsDomain)) {
|
if (!empty($functionsDomain) && \str_ends_with($domain->get(), $functionsDomain)) {
|
||||||
$status = 'verified';
|
$status = 'verified';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -742,24 +742,6 @@ services:
|
||||||
- OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
|
- OPR_EXECUTOR_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
|
||||||
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
|
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
|
||||||
|
|
||||||
# openruntimes-proxy:
|
|
||||||
# container_name: openruntimes-proxy
|
|
||||||
# hostname: proxy
|
|
||||||
# <<: *x-logging
|
|
||||||
# image: meldiron/proxy:0.3.0
|
|
||||||
# networks:
|
|
||||||
# - appwrite
|
|
||||||
# environment:
|
|
||||||
# - OPR_PROXY_ALGORITHM=random
|
|
||||||
# - OPR_PROXY_EXECUTORS=exc1,exc2
|
|
||||||
# - OPR_PROXY_HEALTHCHECK=enabled
|
|
||||||
# - OPR_PROXY_HEALTHCHECK_INTERVAL=10000
|
|
||||||
# - OPR_PROXY_SECRET=$_APP_EXECUTOR_SECRET
|
|
||||||
# - OPR_PROXY_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET
|
|
||||||
# - OPR_PROXY_ENV=development
|
|
||||||
# - OPR_PROXY_LOGGING_PROVIDER=$_APP_LOGGING_PROVIDER
|
|
||||||
# - OPR_PROXY_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
|
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p
|
image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p
|
||||||
container_name: appwrite-mariadb
|
container_name: appwrite-mariadb
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Create a new function variable. These variables can be accessed within function in the `env` object under the request variable.
|
Create a new function variable. These variables can be accessed within function as environment variable.
|
|
@ -1 +1 @@
|
||||||
Create a new project variable. These variables can be accessed by every function.
|
Create a new project variable.
|
|
@ -12,9 +12,9 @@ class Branch extends Model
|
||||||
$this
|
$this
|
||||||
->addRule('name', [
|
->addRule('name', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'Repository Name.',
|
'description' => 'Branch Name.',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => 'appwrite',
|
'example' => 'main',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue