Merge pull request #713 from appwrite/feat-upgrade-php-version
Feat upgrade php version (8.0)
|
|
@ -26,6 +26,8 @@ before_install:
|
|||
- docker buildx create --use
|
||||
- chmod -R u+x ./.travis-ci
|
||||
- export COMPOSE_INTERACTIVE_NO_CLI=1
|
||||
# Only pass a single runtime for CI stability
|
||||
- echo "_APP_FUNCTIONS_ENVS=php-8.0" >> .env
|
||||
|
||||
install:
|
||||
- docker-compose up -d
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
- Enabled 501 errors (Not Implemented) from the error handler
|
||||
- Added Python 3.9 as a new Cloud Functions runtime
|
||||
- Added Deno 1.8 as a new Cloud Functions runtime (#989)
|
||||
- Upgraded to PHP 8.0 (#713)
|
||||
- ClamAV is now disabled by default to allow lower min requirments for Appwrite (#1064)
|
||||
- Added a new env var named `_APP_LOCALE` that allow to change the default `en` locale value (#1056)
|
||||
- Updated all the console bottom control to be consistent. Dropped the `+` icon (#1062)
|
||||
|
|
@ -30,9 +31,12 @@
|
|||
## Breaking Changes (Read before upgrading!)
|
||||
|
||||
- Rename `deleteuser` to `delete` on Users Api
|
||||
- Environment variable `_APP_FUNCTIONS_ENVS` renamed to `_APP_FUNCTIONS_RUNTIMES`
|
||||
- Only logged in users can execute functions (for guests, use anonymous login)
|
||||
- Only the user who has triggered the execution get access to the relevant execution logs
|
||||
- Function execution env `APPWRITE_FUNCTION_EVENT_PAYLOAD` renamed to `APPWRITE_FUNCTION_EVENT_DATA`
|
||||
- Function execution environment variable `APPWRITE_FUNCTION_EVENT_PAYLOAD` renamed to `APPWRITE_FUNCTION_EVENT_DATA`
|
||||
- Function execution environment variable `APPWRITE_FUNCTION_ENV_NAME` renamed to `APPWRITE_FUNCTION_RUNTIME_NAME`
|
||||
- Function execution environment variable `APPWRITE_FUNCTION_ENV_VERSION` renamed to `APPWRITE_FUNCTION_RUNTIME_VERSION`
|
||||
- Introdcues rate limits for:
|
||||
- Team invite (10 requests in every 60 minutes per IP address)
|
||||
|
||||
|
|
|
|||
|
|
@ -278,13 +278,9 @@ Before running the command, make sure you have proper write permissions to the A
|
|||
```bash
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x -t appwrite/appwrite:dev --push .
|
||||
```
|
||||
**Build Functions Envs**
|
||||
**Build Functions Runtimes**
|
||||
|
||||
Build envs for all supported cloud functions (multicore builds)
|
||||
|
||||
```bash
|
||||
bash ./docker/environments/build.sh
|
||||
```
|
||||
The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/php-runtimes](https://github.com/appwrite/php-runtimes) repository.
|
||||
|
||||
## Tests
|
||||
|
||||
|
|
|
|||
61
Dockerfile
|
|
@ -12,12 +12,13 @@ RUN composer update --ignore-platform-reqs --optimize-autoloader \
|
|||
--no-plugins --no-scripts --prefer-dist \
|
||||
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
|
||||
|
||||
FROM php:7.4-cli-alpine as step1
|
||||
FROM php:8.0-cli-alpine as step1
|
||||
|
||||
ENV PHP_REDIS_VERSION=5.3.3 \
|
||||
PHP_SWOOLE_VERSION=v4.5.8 \
|
||||
PHP_MAXMINDDB_VERSION=v1.10.0 \
|
||||
PHP_XDEBUG_VERSION=sdebug_2_9-beta
|
||||
ENV PHP_REDIS_VERSION=5.3.4 \
|
||||
PHP_SWOOLE_VERSION=v4.6.6 \
|
||||
PHP_IMAGICK_VERSION=master \
|
||||
PHP_YAML_VERSION=2.2.1 \
|
||||
PHP_MAXMINDDB_VERSION=v1.10.1
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --virtual .deps \
|
||||
|
|
@ -29,38 +30,52 @@ RUN \
|
|||
git \
|
||||
zlib-dev \
|
||||
brotli-dev \
|
||||
yaml-dev \
|
||||
imagemagick \
|
||||
imagemagick-dev \
|
||||
libmaxminddb-dev
|
||||
|
||||
RUN docker-php-ext-install sockets
|
||||
|
||||
RUN \
|
||||
# Redis Extension
|
||||
git clone https://github.com/phpredis/phpredis.git && \
|
||||
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git && \
|
||||
cd phpredis && \
|
||||
git checkout $PHP_REDIS_VERSION && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
## Swoole Extension
|
||||
git clone https://github.com/swoole/swoole-src.git && \
|
||||
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \
|
||||
cd swoole-src && \
|
||||
git checkout $PHP_SWOOLE_VERSION && \
|
||||
phpize && \
|
||||
./configure --enable-sockets --enable-http2 && \
|
||||
./configure --enable-http2 && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
## Imagick Extension
|
||||
git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/Imagick/imagick && \
|
||||
cd imagick && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
## YAML Extension
|
||||
git clone --depth 1 --branch $PHP_YAML_VERSION https://github.com/php/pecl-file_formats-yaml && \
|
||||
cd pecl-file_formats-yaml && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
## Maxminddb extension
|
||||
git clone https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
|
||||
git clone --depth 1 --branch $PHP_MAXMINDDB_VERSION https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
|
||||
cd MaxMind-DB-Reader-php && \
|
||||
git checkout $PHP_MAXMINDDB_VERSION && \
|
||||
cd ext && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd ../..
|
||||
|
||||
FROM php:7.4-cli-alpine as final
|
||||
FROM php:8.0-cli-alpine as final
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
|
|
@ -124,16 +139,14 @@ RUN \
|
|||
curl-dev \
|
||||
&& apk add --no-cache \
|
||||
libstdc++ \
|
||||
certbot \
|
||||
brotli-dev \
|
||||
yaml-dev \
|
||||
imagemagick \
|
||||
imagemagick-dev \
|
||||
libmaxminddb-dev \
|
||||
certbot \
|
||||
docker-cli \
|
||||
docker-compose \
|
||||
libmaxminddb \
|
||||
libmaxminddb-dev \
|
||||
&& pecl install imagick yaml \
|
||||
&& docker-php-ext-enable imagick yaml \
|
||||
&& docker-php-ext-install sockets opcache pdo_mysql \
|
||||
&& apk del .deps \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
|
@ -141,9 +154,11 @@ RUN \
|
|||
WORKDIR /usr/src/code
|
||||
|
||||
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/maxminddb.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/maxminddb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
|
||||
|
||||
# Add Source Code
|
||||
COPY ./app /usr/src/code/app
|
||||
|
|
@ -191,11 +206,15 @@ RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
|||
# Enable Extensions
|
||||
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
|
||||
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
|
||||
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
|
||||
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
|
||||
RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini
|
||||
|
||||
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.jit_buffer_size=100M" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.jit=1235" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
|
|
|
|||
|
|
@ -1,165 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Utopia\App;
|
||||
use Utopia\System\System;
|
||||
|
||||
/**
|
||||
* List of Appwrite Cloud Functions supported environments
|
||||
*/
|
||||
$environments = [
|
||||
'node-14.5' => [
|
||||
'name' => 'Node.js',
|
||||
'version' => '14.5',
|
||||
'base' => 'node:14.5-alpine',
|
||||
'image' => 'appwrite/env-node-14.5:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/node-14.5',
|
||||
'logo' => 'node.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'node-15.5' => [
|
||||
'name' => 'Node.js',
|
||||
'version' => '15.5',
|
||||
'base' => 'node:15.5-alpine',
|
||||
'image' => 'appwrite/env-node-15.5:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/node-15.5',
|
||||
'logo' => 'node.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'php-7.4' => [
|
||||
'name' => 'PHP',
|
||||
'version' => '7.4',
|
||||
'base' => 'php:7.4-cli-alpine',
|
||||
'image' => 'appwrite/env-php-7.4:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/php-7.4',
|
||||
'logo' => 'php.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'php-8.0' => [
|
||||
'name' => 'PHP',
|
||||
'version' => '8.0',
|
||||
'base' => 'php:8.0-cli-alpine',
|
||||
'image' => 'appwrite/env-php-8.0:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/php-8.0',
|
||||
'logo' => 'php.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'ruby-2.7' => [
|
||||
'name' => 'Ruby',
|
||||
'version' => '2.7',
|
||||
'base' => 'ruby:2.7-alpine',
|
||||
'image' => 'appwrite/env-ruby-2.7:1.0.2',
|
||||
'build' => '/usr/src/code/docker/environments/ruby-2.7',
|
||||
'logo' => 'ruby.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'ruby-3.0' => [
|
||||
'name' => 'Ruby',
|
||||
'version' => '3.0',
|
||||
'base' => 'ruby:3.0-alpine',
|
||||
'image' => 'appwrite/env-ruby-3.0:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/ruby-3.0',
|
||||
'logo' => 'ruby.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'python-3.8' => [
|
||||
'name' => 'Python',
|
||||
'version' => '3.8',
|
||||
'base' => 'python:3.8-alpine',
|
||||
'image' => 'appwrite/env-python-3.8:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/python-3.8',
|
||||
'logo' => 'python.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'python-3.9' => [
|
||||
'name' => 'Python',
|
||||
'version' => '3.9',
|
||||
'base' => 'python:3.9-alpine',
|
||||
'image' => 'appwrite/env-python-3.9:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/python-3.9',
|
||||
'logo' => 'python.png',
|
||||
'supports' => [System::X86, System::PPC, System::ARM],
|
||||
],
|
||||
'deno-1.2' => [
|
||||
'name' => 'Deno',
|
||||
'version' => '1.2',
|
||||
'base' => 'hayd/deno:alpine-1.2.0',
|
||||
'image' => 'appwrite/env-deno-1.2:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/deno-1.2',
|
||||
'logo' => 'deno.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'deno-1.5' => [
|
||||
'name' => 'Deno',
|
||||
'version' => '1.5',
|
||||
'base' => 'hayd/deno:alpine-1.5.0',
|
||||
'image' => 'appwrite/env-deno-1.5:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/deno-1.5',
|
||||
'logo' => 'deno.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'deno-1.6' => [
|
||||
'name' => 'Deno',
|
||||
'version' => '1.6',
|
||||
'base' => 'hayd/deno:alpine-1.6.0',
|
||||
'image' => 'appwrite/env-deno-1.6:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/deno-1.6',
|
||||
'logo' => 'deno.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'deno-1.8' => [
|
||||
'name' => 'Deno',
|
||||
'version' => '1.8',
|
||||
'base' => 'hayd/deno:alpine-1.8.2',
|
||||
'image' => 'appwrite/env-deno-1.8:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/deno-1.8',
|
||||
'logo' => 'deno.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'dart-2.10' => [
|
||||
'name' => 'Dart',
|
||||
'version' => '2.10',
|
||||
'base' => 'google/dart:2.10',
|
||||
'image' => 'appwrite/env-dart-2.10:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/dart-2.10',
|
||||
'logo' => 'dart.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'dart-2.12' => [
|
||||
'name' => 'Dart',
|
||||
'version' => '2.12',
|
||||
'base' => 'google/dart:2.12',
|
||||
'image' => 'appwrite/env-dart-2.12:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/dart-2.12',
|
||||
'logo' => 'dart.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'dotnet-3.1' => [
|
||||
'name' => '.NET',
|
||||
'version' => '3.1',
|
||||
'base' => 'mcr.microsoft.com/dotnet/runtime:3.1-alpine',
|
||||
'image' => 'appwrite/env-dotnet-3.1:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/dotnet-3.1',
|
||||
'logo' => 'dotnet.png',
|
||||
'supports' => [System::X86],
|
||||
],
|
||||
'dotnet-5.0' => [
|
||||
'name' => '.NET',
|
||||
'version' => '5.0',
|
||||
'base' => 'mcr.microsoft.com/dotnet/runtime:5.0-alpine',
|
||||
'image' => 'appwrite/env-dotnet-5.0:1.0.0',
|
||||
'build' => '/usr/src/code/docker/environments/dotnet-5.0',
|
||||
'logo' => 'dotnet.png',
|
||||
'supports' => [System::X86, System::ARM],
|
||||
],
|
||||
];
|
||||
|
||||
$allowList = empty(App::getEnv('_APP_FUNCTIONS_ENVS', null)) ? false : \explode(',', App::getEnv('_APP_FUNCTIONS_ENVS', null));
|
||||
|
||||
$environments = array_filter($environments, function ($environment, $key) use ($allowList) {
|
||||
$isAllowed = $allowList && in_array($key, $allowList);
|
||||
$isSupported = in_array(System::getArchEnum(), $environment["supports"]);
|
||||
|
||||
return $allowList ? ($isAllowed && $isSupported) : $isSupported;
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
|
||||
return $environments;
|
||||
15
app/config/runtimes.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Utopia\App;
|
||||
use Appwrite\Runtimes\Runtimes;
|
||||
|
||||
/**
|
||||
* List of Appwrite Cloud Functions supported runtimes
|
||||
*/
|
||||
$runtimes = new Runtimes();
|
||||
|
||||
$allowList = empty(App::getEnv('_APP_FUNCTIONS_RUNTIMES')) ? [] : \explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES'));
|
||||
|
||||
$runtimes = $runtimes->getAll(filter: $allowList);
|
||||
|
||||
return $runtimes;
|
||||
|
|
@ -386,8 +386,16 @@ return [
|
|||
'question' => '',
|
||||
],
|
||||
[
|
||||
'name' => '_APP_FUNCTIONS_ENVS',
|
||||
'name' => '_APP_FUNCTIONS_RUNTIMES',
|
||||
'description' => 'This option allows you to limit the available environments for cloud functions. This option is very useful for low-cost servers to safe disk space.\n\nTo enable/activate this option, pass a list of allowed environments separated by a comma.\n\nCurrently, supported environments are: ' . \implode(', ', \array_keys(Config::getParam('providers'))),
|
||||
'introduction' => '0.8.0',
|
||||
'default' => 'node-15.5,deno-1.8,php-8.0,python-3.9,ruby-3.0,dotnet-5.0',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
],
|
||||
[
|
||||
'name' => '_APP_FUNCTIONS_ENVS',
|
||||
'description' => 'Deprectated with 0.8.0, use \'_APP_FUNCTIONS_RUNTIMES\' instead!',
|
||||
'introduction' => '0.7.0',
|
||||
'default' => 'node-14.5,deno-1.8,php-7.4,python-3.9,ruby-3.0,dotnet-5.0',
|
||||
'required' => false,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ App::post('/v1/functions')
|
|||
->label('sdk.response.model', Response::MODEL_FUNCTION)
|
||||
->param('name', '', new Text(128), 'Function name. Max length: 128 chars.')
|
||||
->param('execute', [], new ArrayList(new Text(64)), 'An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
|
||||
->param('env', '', new WhiteList(array_keys(Config::getParam('environments')), true), 'Execution enviornment.')
|
||||
->param('env', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution enviornment.')
|
||||
->param('vars', [], new Assoc(), 'Key-value JSON object.', true)
|
||||
->param('events', [], new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)), 'Events list.', true)
|
||||
->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ App::get('/v1/mock/tests/general/oauth2')
|
|||
->param('scope', '', new Text(100), 'OAuth2 scope list.')
|
||||
->param('state', '', new Text(1024), 'OAuth2 state.')
|
||||
->inject('response')
|
||||
->action(function ($clientId, $redirectURI, $scope, $state, $response) {
|
||||
->action(function ($client_id, $redirectURI, $scope, $state, $response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->redirect($redirectURI.'?'.\http_build_query(['code' => 'abcdef', 'state' => $state]));
|
||||
|
|
@ -387,14 +387,14 @@ App::get('/v1/mock/tests/general/oauth2/token')
|
|||
->param('client_secret', '', new Text(100), 'OAuth2 scope list.')
|
||||
->param('code', '', new Text(100), 'OAuth2 state.')
|
||||
->inject('response')
|
||||
->action(function ($clientId, $redirectURI, $clientSecret, $code, $response) {
|
||||
->action(function ($client_id, $redirectURI, $client_secret, $code, $response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
if ($clientId != '1') {
|
||||
if ($client_id != '1') {
|
||||
throw new Exception('Invalid client ID');
|
||||
}
|
||||
|
||||
if ($clientSecret != '123456') {
|
||||
if ($client_secret != '123456') {
|
||||
throw new Exception('Invalid client secret');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ App::init(function ($utopia, $request, $response, $layout) {
|
|||
['type' => 'developer', 'label' => 'Developer'],
|
||||
['type' => 'admin', 'label' => 'Admin'],
|
||||
])
|
||||
->setParam('environments', Config::getParam('environments'))
|
||||
->setParam('runtimes', Config::getParam('runtimes'))
|
||||
->setParam('mode', App::getMode())
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ App::get('/console/functions')
|
|||
$page = new View(__DIR__.'/../../views/console/functions/index.phtml');
|
||||
|
||||
$page
|
||||
->setParam('environments', Config::getParam('environments'))
|
||||
->setParam('runtimes', Config::getParam('runtimes'))
|
||||
;
|
||||
|
||||
$layout
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ Config::load('auth', __DIR__.'/config/auth.php');
|
|||
Config::load('providers', __DIR__.'/config/providers.php');
|
||||
Config::load('platforms', __DIR__.'/config/platforms.php');
|
||||
Config::load('collections', __DIR__.'/config/collections.php');
|
||||
Config::load('environments', __DIR__.'/config/environments.php');
|
||||
Config::load('runtimes', __DIR__.'/config/runtimes.php');
|
||||
Config::load('roles', __DIR__.'/config/roles.php'); // User roles and scopes
|
||||
Config::load('scopes', __DIR__.'/config/scopes.php'); // User roles and scopes
|
||||
Config::load('services', __DIR__.'/config/services.php'); // List of services
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
|
|||
|
||||
<div class="box margin-bottom-large">
|
||||
<div class="text-align-center">
|
||||
<img src="" data-ls-attrs="src=/images/environments/{{project-function.env|envLogo}}" alt="Function Env." class="avatar huge margin-top-negative-xxl" />
|
||||
<img src="" data-ls-attrs="src=/images/runtimes/{{project-function.env|envLogo}}" alt="Function Env." class="avatar huge margin-top-negative-xxl" />
|
||||
|
||||
<p class="text-fade margin-bottom-small" data-ls-bind="{{project-function.env|envName}} {{project-function.env|envVersion}}">
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
$environments = $this->getParam('environments', []);
|
||||
$runtimes = $this->getParam('runtimes', []);
|
||||
?>
|
||||
<div class="cover">
|
||||
<h1 class="zone xl margin-bottom-large">
|
||||
|
|
@ -40,7 +40,7 @@ $environments = $this->getParam('environments', []);
|
|||
<ul data-ls-loop="project-functions.functions" data-ls-as="function" class="list">
|
||||
<li class="clear">
|
||||
<div class="pull-start margin-end avatar-container">
|
||||
<img src="" data-ls-attrs="src=/images/environments/{{function.env|envLogo}}?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Function Env." class="avatar" loading="lazy" width="60" height="60" />
|
||||
<img src="" data-ls-attrs="src=/images/runtimes/{{function.env|envLogo}}?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Function Env." class="avatar" loading="lazy" width="60" height="60" />
|
||||
</div>
|
||||
|
||||
<a data-ls-attrs="href=/console/functions/function?id={{function.$id}}&project={{router.params.project}}" class="button pull-end">Settings</a>
|
||||
|
|
@ -109,10 +109,10 @@ $environments = $this->getParam('environments', []);
|
|||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="name" required autocomplete="off" class="margin-bottom" maxlength="128" />
|
||||
|
||||
<label for="env">Environment</label>
|
||||
<label for="env">Runtimes</label>
|
||||
<select name="env" id="env" required class="margin-bottom-xl">
|
||||
<?php foreach($environments as $key => $environment): ?>
|
||||
<option value="<?php echo $this->escape($key); ?>"><?php echo $this->escape($environment['name']); ?> <?php echo $this->escape($environment['version']); ?></option>
|
||||
<?php foreach($runtimes as $key => $runtime): ?>
|
||||
<option value="<?php echo $this->escape($key); ?>"><?php echo $this->escape($runtime['name']); ?> <?php echo $this->escape($runtime['version']); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ services:
|
|||
- _APP_FUNCTIONS_CPUS
|
||||
- _APP_FUNCTIONS_MEMORY
|
||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||
- _APP_FUNCTIONS_ENVS
|
||||
- _APP_FUNCTIONS_RUNTIMES
|
||||
|
||||
appwrite-worker-usage:
|
||||
image: appwrite/appwrite:<?php echo $version."\n"; ?>
|
||||
|
|
@ -266,6 +266,7 @@ services:
|
|||
- _APP_FUNCTIONS_CPUS
|
||||
- _APP_FUNCTIONS_MEMORY
|
||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||
- _APP_FUNCTIONS_RUNTIMES
|
||||
- _APP_USAGE_STATS
|
||||
|
||||
appwrite-worker-mails:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $analytics = $this->getParam('analytics', 'UA-26264668-9');
|
|||
$mode = $this->getParam('mode', '');
|
||||
$canonical = $this->getParam('canonical', '');
|
||||
$locale = $this->getParam('locale', null);
|
||||
$environments = $this->getParam('environments', null);
|
||||
$runtimes = $this->getParam('runtimes', null);
|
||||
|
||||
if(!empty($platforms)) {
|
||||
$platforms = array_map(function($platform) {
|
||||
|
|
@ -78,7 +78,7 @@ if(!empty($platforms)) {
|
|||
SETUP: '<?php echo $this->escape($this->getParam('setup')); ?>',
|
||||
API: '/v1',
|
||||
PROJECT: 'console',
|
||||
ENVIRONMENTS: <?php echo json_encode($environments); ?>,
|
||||
RUNTIMES: <?php echo json_encode($runtimes); ?>,
|
||||
PLATFORMS: <?php echo json_encode($platforms); ?>,
|
||||
LOCALE: '<?php echo $this->escape($locale->getText('settings.locale')); ?>',
|
||||
PREFIX: '<?php echo $this->escape($this->getParam('prefix')); ?>',
|
||||
|
|
|
|||
|
|
@ -14,21 +14,19 @@ use Utopia\Config\Config;
|
|||
|
||||
require_once __DIR__.'/../init.php';
|
||||
|
||||
Runtime::enableCoroutine(0);
|
||||
|
||||
Console::title('Functions V1 Worker');
|
||||
|
||||
Runtime::setHookFlags(SWOOLE_HOOK_ALL);
|
||||
|
||||
Console::success(APP_NAME.' functions worker v1 has started');
|
||||
|
||||
$environments = Config::getParam('environments');
|
||||
$runtimes = Config::getParam('runtimes');
|
||||
|
||||
/**
|
||||
* Warmup Docker Images
|
||||
*/
|
||||
$warmupStart = \microtime(true);
|
||||
|
||||
Co\run(function() use ($environments) { // Warmup: make sure images are ready to run fast 🚀
|
||||
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
||||
Co\run(function() use ($runtimes) { // Warmup: make sure images are ready to run fast 🚀
|
||||
|
||||
$dockerUser = App::getEnv('DOCKERHUB_PULL_USERNAME', null);
|
||||
$dockerPass = App::getEnv('DOCKERHUB_PULL_PASSWORD', null);
|
||||
|
|
@ -41,14 +39,14 @@ Co\run(function() use ($environments) { // Warmup: make sure images are ready t
|
|||
Console::log('Docker Login'. $stdout.$stderr);
|
||||
}
|
||||
|
||||
foreach($environments as $environment) {
|
||||
go(function() use ($environment) {
|
||||
foreach($runtimes as $runtime) {
|
||||
go(function() use ($runtime) {
|
||||
$stdout = '';
|
||||
$stderr = '';
|
||||
|
||||
Console::info('Warming up '.$environment['name'].' '.$environment['version'].' environment...');
|
||||
Console::info('Warming up '.$runtime['name'].' '.$runtime['version'].' environment...');
|
||||
|
||||
Console::execute('docker pull '.$environment['image'], '', $stdout, $stderr);
|
||||
Console::execute('docker pull '.$runtime['image'], '', $stdout, $stderr);
|
||||
|
||||
if(!empty($stdout)) {
|
||||
Console::log($stdout);
|
||||
|
|
@ -293,7 +291,7 @@ class FunctionsV1
|
|||
{
|
||||
global $list;
|
||||
|
||||
$environments = Config::getParam('environments');
|
||||
$runtimes = Config::getParam('runtimes');
|
||||
|
||||
Authorization::disable();
|
||||
$tag = $database->getDocument($function->getAttribute('tag', ''));
|
||||
|
|
@ -327,11 +325,11 @@ class FunctionsV1
|
|||
|
||||
Authorization::reset();
|
||||
|
||||
$environment = (isset($environments[$function->getAttribute('env', '')]))
|
||||
? $environments[$function->getAttribute('env', '')]
|
||||
$runtime = (isset($runtimes[$function->getAttribute('env', '')]))
|
||||
? $runtimes[$function->getAttribute('env', '')]
|
||||
: null;
|
||||
|
||||
if(\is_null($environment)) {
|
||||
if(\is_null($runtime)) {
|
||||
throw new Exception('Environment "'.$function->getAttribute('env', '').' is not supported');
|
||||
}
|
||||
|
||||
|
|
@ -340,8 +338,8 @@ class FunctionsV1
|
|||
'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name', ''),
|
||||
'APPWRITE_FUNCTION_TAG' => $tag->getId(),
|
||||
'APPWRITE_FUNCTION_TRIGGER' => $trigger,
|
||||
'APPWRITE_FUNCTION_ENV_NAME' => $environment['name'],
|
||||
'APPWRITE_FUNCTION_ENV_VERSION' => $environment['version'],
|
||||
'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'],
|
||||
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'],
|
||||
'APPWRITE_FUNCTION_EVENT' => $event,
|
||||
'APPWRITE_FUNCTION_EVENT_DATA' => $eventData,
|
||||
'APPWRITE_FUNCTION_DATA' => $data,
|
||||
|
|
@ -419,7 +417,7 @@ class FunctionsV1
|
|||
" --volume {$tagPathTargetDir}:/tmp:rw".
|
||||
" --workdir /usr/local/src".
|
||||
" ".\implode(" ", $vars).
|
||||
" {$environment['image']}".
|
||||
" {$runtime['image']}".
|
||||
" sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'"
|
||||
, '', $stdout, $stderr, 30);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4.0",
|
||||
"php": ">=8.0.0",
|
||||
"ext-curl": "*",
|
||||
"ext-imagick": "*",
|
||||
"ext-mbstring": "*",
|
||||
|
|
@ -35,37 +35,37 @@
|
|||
"ext-zlib": "*",
|
||||
"ext-sockets": "*",
|
||||
|
||||
"appwrite/php-clamav": "1.0.*",
|
||||
"appwrite/php-clamav": "1.1.*",
|
||||
"appwrite/php-runtimes": "0.2.*",
|
||||
|
||||
"utopia-php/framework": "0.12.*",
|
||||
"utopia-php/abuse": "0.4.*",
|
||||
"utopia-php/analytics": "0.2.*",
|
||||
"utopia-php/audit": "0.5.*",
|
||||
"utopia-php/cache": "0.2.*",
|
||||
"utopia-php/cli": "0.10.0",
|
||||
"utopia-php/cli": "0.10.*",
|
||||
"utopia-php/config": "0.2.*",
|
||||
"utopia-php/locale": "0.3.*",
|
||||
"utopia-php/registry": "0.2.*",
|
||||
"utopia-php/registry": "0.4.*",
|
||||
"utopia-php/preloader": "0.2.*",
|
||||
"utopia-php/domains": "0.2.*",
|
||||
"utopia-php/domains": "1.1.*",
|
||||
"utopia-php/swoole": "0.2.*",
|
||||
"utopia-php/system": "0.4.*",
|
||||
"utopia-php/storage": "0.4.3",
|
||||
"utopia-php/storage": "0.4.*",
|
||||
"utopia-php/image": "0.2.*",
|
||||
"resque/php-resque": "1.3.6",
|
||||
"matomo/device-detector": "4.1.0",
|
||||
"matomo/device-detector": "4.2.2",
|
||||
"dragonmantank/cron-expression": "3.1.0",
|
||||
"influxdb/influxdb-php": "1.15.2",
|
||||
"phpmailer/phpmailer": "6.3.0",
|
||||
"phpmailer/phpmailer": "6.4.0",
|
||||
"chillerlan/php-qrcode": "4.3.0",
|
||||
"adhocore/jwt": "1.1.2",
|
||||
"slickdeals/statsd": "~3.0"
|
||||
"slickdeals/statsd": "3.0.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"appwrite/sdk-generator": "dev-feat-preps-for-0.8",
|
||||
"phpunit/phpunit": "9.4.2",
|
||||
"swoole/ide-helper": "4.5.5",
|
||||
"vimeo/psalm": "4.1.1"
|
||||
"swoole/ide-helper": "4.6.6",
|
||||
"phpunit/phpunit": "9.5.4",
|
||||
"vimeo/psalm": "4.7.1"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
|
@ -76,10 +76,9 @@
|
|||
"provide": {
|
||||
"ext-phpiredis": "*"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.4"
|
||||
"php": "8.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
930
composer.lock
generated
|
|
@ -111,7 +111,7 @@ services:
|
|||
- _APP_FUNCTIONS_CPUS
|
||||
- _APP_FUNCTIONS_MEMORY
|
||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||
- _APP_FUNCTIONS_ENVS
|
||||
- _APP_FUNCTIONS_RUNTIMES
|
||||
|
||||
appwrite-worker-usage:
|
||||
entrypoint: worker-usage
|
||||
|
|
@ -283,7 +283,6 @@ services:
|
|||
- /tmp:/tmp:rw
|
||||
- ./app:/usr/src/code/app
|
||||
- ./src:/usr/src/code/src
|
||||
- ./docker:/usr/src/code/docker
|
||||
depends_on:
|
||||
- redis
|
||||
- mariadb
|
||||
|
|
@ -300,6 +299,7 @@ services:
|
|||
- _APP_DB_PASS
|
||||
- _APP_FUNCTIONS_TIMEOUT
|
||||
- _APP_FUNCTIONS_CONTAINERS
|
||||
- _APP_FUNCTIONS_RUNTIMES
|
||||
- _APP_FUNCTIONS_CPUS
|
||||
- _APP_FUNCTIONS_MEMORY
|
||||
- _APP_FUNCTIONS_MEMORY_SWAP
|
||||
|
|
@ -467,6 +467,7 @@ services:
|
|||
|
||||
adminer:
|
||||
image: adminer
|
||||
container_name: appwrite-adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 9505:8080
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
# Appwrite Functions Environments
|
||||
|
||||
Docker based enviornments for Appwrite Functions. You can use this Docker images to locally tests your functions by executing them on your local desktop or server.
|
||||
|
||||
All the supported enviornments are based on Docker Alpine images.
|
||||
|
||||
## Build
|
||||
|
||||
Build envs for all supported cloud functions (multicore builds)
|
||||
|
||||
```bash
|
||||
bash ./docker/environments/build.sh
|
||||
```
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
echo 'Starting build...'
|
||||
|
||||
echo 'Deno 1.2...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-deno-1.2:1.0.0 ./docker/environments/deno-1.2/ --push
|
||||
|
||||
echo 'Deno 1.5...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-deno-1.5:1.0.0 ./docker/environments/deno-1.5/ --push
|
||||
|
||||
echo 'Deno 1.6...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-deno-1.6:1.0.0 ./docker/environments/deno-1.6/ --push
|
||||
|
||||
echo 'Deno 1.8...'
|
||||
docker buildx build --platform linux/amd64,linux/386 -t appwrite/env-deno-1.8:1.0.0 ./docker/environments/deno-1.8/ --push
|
||||
|
||||
echo 'Node 14.5...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le -t appwrite/env-node-14.5:1.0.0 ./docker/environments/node-14.5/ --push
|
||||
|
||||
echo 'Node 15.5...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le -t appwrite/env-node-15.5:1.0.0 ./docker/environments/node-15.5/ --push
|
||||
|
||||
echo 'PHP 7.4...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-php-7.4:1.0.0 ./docker/environments/php-7.4/ --push
|
||||
|
||||
echo 'PHP 8.0...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-php-8.0:1.0.0 ./docker/environments/php-8.0/ --push
|
||||
|
||||
echo 'Python 3.8...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-python-3.8:1.0.0 ./docker/environments/python-3.8/ --push
|
||||
|
||||
echo 'Python 3.9...'
|
||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-python-3.9:1.0.0 ./docker/environments/python-3.9/ --push
|
||||
|
||||
echo 'Ruby 2.7...'
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-2.7:1.0.2 ./docker/environments/ruby-2.7/ --push
|
||||
|
||||
echo 'Ruby 3.0...'
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/386,linux/ppc64le -t appwrite/env-ruby-3.0:1.0.0 ./docker/environments/ruby-3.0/ --push
|
||||
|
||||
echo 'Dart 2.10...'
|
||||
docker buildx build --platform linux/amd64 -t appwrite/env-dart-2.10:1.0.0 ./docker/environments/dart-2.10/ --push
|
||||
|
||||
echo 'Dart 2.12...'
|
||||
docker buildx build --platform linux/amd64 -t appwrite/env-dart-2.12:1.0.0 ./docker/environments/dart-2.12/ --push
|
||||
|
||||
echo '.NET 3.1...'
|
||||
docker buildx build --platform linux/amd64 -t appwrite/env-dotnet-3.1:1.0.0 ./docker/environments/dotnet-3.1/ --push
|
||||
|
||||
echo '.NET 5.0...'
|
||||
docker buildx build --platform linux/amd64,linux/arm64 -t appwrite/env-dotnet-5.0:1.0.0 ./docker/environments/dotnet-5.0/ --push
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM google/dart:2.10
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apt-get update -y && apt-get install -y tar
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV PUB_CACHE=/usr/local/src/.appwrite
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM google/dart:2.12
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apt-get update -y && apt-get install -y tar
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV PUB_CACHE=/usr/local/src/.appwrite
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM hayd/deno:alpine-1.2.0
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV DENO_DIR=/usr/local/src/.appwrite
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM hayd/deno:alpine-1.5.0
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV DENO_DIR=/usr/local/src/.appwrite
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM hayd/deno:alpine-1.6.2
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV DENO_DIR=/usr/local/src/.appwrite
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM hayd/deno:alpine-1.8.3
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV DENO_DIR=/usr/local/src/.appwrite
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
FROM mcr.microsoft.com/dotnet/runtime:3.1-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM node:14.5-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM node:15.5-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM php:7.4-cli-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM php:8.0-cli-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM python:3.8-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV PYTHONPATH "${PYTHONPATH}:/usr/local/src/.appwrite"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
FROM python:3.9-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV PYTHONPATH "${PYTHONPATH}:/usr/local/src/.appwrite"
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
FROM ruby:2.7-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV GEM_PATH=/usr/local/src/.appwrite
|
||||
ENV GEM_SPEC_CACHE=/usr/local/src/.appwrite/specs
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
FROM ruby:3.0-alpine
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
RUN apk add tar
|
||||
|
||||
RUN mkdir /usr/local/src
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
ENV GEM_PATH=/usr/local/src/.appwrite
|
||||
ENV GEM_SPEC_CACHE=/usr/local/src/.appwrite/specs
|
||||
16
phpunit.xml
|
|
@ -12,25 +12,27 @@
|
|||
<extension class="Appwrite\Tests\TestHook" />
|
||||
</extensions>
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<testsuite name="unit">
|
||||
<directory>./tests/unit/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="e2e">
|
||||
<file>./tests/e2e/Client.php</file>
|
||||
<directory>./tests/e2e/General</directory>
|
||||
<directory>./tests/e2e/Scopes</directory>
|
||||
<directory>./tests/e2e/Services/Projects</directory>
|
||||
<directory>./tests/e2e/Services/Account</directory>
|
||||
<directory>./tests/e2e/Services/Avatars</directory>
|
||||
<directory>./tests/e2e/Services/Database</directory>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsBase.php</file>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsCustomServerTest.php</file>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsCustomClientTest.php</file>
|
||||
<directory>./tests/e2e/Services/Health</directory>
|
||||
<directory>./tests/e2e/Services/Locale</directory>
|
||||
<directory>./tests/e2e/Services/Projects</directory>
|
||||
<directory>./tests/e2e/Services/Storage</directory>
|
||||
<directory>./tests/e2e/Services/Teams</directory>
|
||||
<directory>./tests/e2e/Services/Users</directory>
|
||||
<directory>./tests/e2e/Services/Webhooks</directory>
|
||||
<directory>./tests/e2e/Services/Workers</directory>
|
||||
<directory>./tests/unit/</directory>
|
||||
<directory>./tests/e2e/Services/Webhooks</directory>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsBase.php</file>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsCustomServerTest.php</file>
|
||||
<file>./tests/e2e/Services/Functions/FunctionsCustomClientTest.php</file>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
6
public/dist/scripts/app-all.js
vendored
|
|
@ -2269,9 +2269,9 @@ return result.length;}).add("documentAction",function(container){let collection=
|
|||
return'database.updateDocument';}).add("documentSuccess",function(container){let document=container.get('project-document');if(document&&!document.$id){return',redirect';}
|
||||
return'';}).add("firstElement",function($value){if($value&&$value[0]){return $value[0];}
|
||||
return $value;}).add("platformsLimit",function($value){return $value;}).add("limit",function($value){let postfix=($value.length>=50)?'...':'';return $value.substring(0,50)+postfix;;}).add("arraySentence",function($value){if(!Array.isArray($value)){return'';}
|
||||
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].name;}
|
||||
return'';}).add("envLogo",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].logo;}
|
||||
return'';}).add("envVersion",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].version;}
|
||||
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].name;}
|
||||
return'';}).add("envLogo",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].logo;}
|
||||
return'';}).add("envVersion",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].version;}
|
||||
return'';});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
|
||||
let abbr;if(number>=1e12){abbr="T";}else if(number>=1e9){abbr="B";}else if(number>=1e6){abbr="M";}else if(number>=1e3){abbr="K";}else{abbr="";}
|
||||
return annotate(number,maxPlaces,forcePlaces,abbr);}
|
||||
|
|
|
|||
6
public/dist/scripts/app.js
vendored
|
|
@ -306,9 +306,9 @@ return result.length;}).add("documentAction",function(container){let collection=
|
|||
return'database.updateDocument';}).add("documentSuccess",function(container){let document=container.get('project-document');if(document&&!document.$id){return',redirect';}
|
||||
return'';}).add("firstElement",function($value){if($value&&$value[0]){return $value[0];}
|
||||
return $value;}).add("platformsLimit",function($value){return $value;}).add("limit",function($value){let postfix=($value.length>=50)?'...':'';return $value.substring(0,50)+postfix;;}).add("arraySentence",function($value){if(!Array.isArray($value)){return'';}
|
||||
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].name;}
|
||||
return'';}).add("envLogo",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].logo;}
|
||||
return'';}).add("envVersion",function($value,env){if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].version;}
|
||||
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].name;}
|
||||
return'';}).add("envLogo",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].logo;}
|
||||
return'';}).add("envVersion",function($value,env){if(env&&env.RUNTIMES&&env.RUNTIMES[$value]){return env.RUNTIMES[$value].version;}
|
||||
return'';});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
|
||||
let abbr;if(number>=1e12){abbr="T";}else if(number>=1e9){abbr="B";}else if(number>=1e6){abbr="M";}else if(number>=1e3){abbr="K";}else{abbr="";}
|
||||
return annotate(number,maxPlaces,forcePlaces,abbr);}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
|
|
@ -235,22 +235,22 @@ window.ls.filter
|
|||
return $value.join(", ").replace(/,\s([^,]+)$/, ' and $1');
|
||||
})
|
||||
.add("envName", function($value, env) {
|
||||
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
|
||||
return env.ENVIRONMENTS[$value].name;
|
||||
if(env && env.RUNTIMES && env.RUNTIMES[$value]) {
|
||||
return env.RUNTIMES[$value].name;
|
||||
}
|
||||
|
||||
return '';
|
||||
})
|
||||
.add("envLogo", function($value, env) {
|
||||
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
|
||||
return env.ENVIRONMENTS[$value].logo;
|
||||
if(env && env.RUNTIMES && env.RUNTIMES[$value]) {
|
||||
return env.RUNTIMES[$value].logo;
|
||||
}
|
||||
|
||||
return '';
|
||||
})
|
||||
.add("envVersion", function($value, env) {
|
||||
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
|
||||
return env.ENVIRONMENTS[$value].version;
|
||||
if(env && env.RUNTIMES && env.RUNTIMES[$value]) {
|
||||
return env.RUNTIMES[$value].version;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Service
|
|||
$ports = (isset($this->service['ports']) && is_array($this->service['ports'])) ? $this->service['ports'] : [];
|
||||
$this->service['ports'] = [];
|
||||
|
||||
array_walk($ports, function(&$value, &$key) {
|
||||
array_walk($ports, function(&$value, $key) {
|
||||
$split = explode(':', $value);
|
||||
$this->service['ports'][
|
||||
(isset($split[0])) ? $split[0] : ''
|
||||
|
|
|
|||
|
|
@ -98,7 +98,15 @@ class PDOStatement extends PDOStatementNative
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function fetchAll($how = null, $class_name = null, $ctor_args = null)
|
||||
/**
|
||||
* Fetch All
|
||||
*
|
||||
* @param int $fetch_style
|
||||
* @param mixed $fetch_args
|
||||
*
|
||||
* @return array|false
|
||||
*/
|
||||
public function fetchAll(int $fetch_style = PDO::FETCH_BOTH, mixed ...$fetch_args)
|
||||
{
|
||||
$result = $this->PDOStatement->fetchAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class V06 extends Migration
|
|||
break;
|
||||
case Database::SYSTEM_COLLECTION_KEYS:
|
||||
if ($document->getAttribute('secret', null)) {
|
||||
$json = \json_decode($document->getAttribute('secret'));
|
||||
if ($json->{'data'} || $json->{'method'} || $json->{'iv'} || $json->{'tag'} || $json->{'version'})
|
||||
$json = \json_decode($document->getAttribute('secret'), true);
|
||||
if (is_array($json))
|
||||
{
|
||||
Console::log('Secret already encrypted. Skipped: ' . $document->getId());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ class Platform extends Model
|
|||
'default' => '',
|
||||
'example' => 'com.company.appname',
|
||||
])
|
||||
// ->addRule('store', [
|
||||
// 'type' => self::TYPE_STRING,
|
||||
// 'description' => 'Link to platform store.',
|
||||
// 'example' => '',
|
||||
// ])
|
||||
->addRule('store', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'App store or Google Play store ID.',
|
||||
'example' => '',
|
||||
])
|
||||
->addRule('hostname', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Web app hostname. Empty string for other platforms.',
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ class Client
|
|||
*/
|
||||
public function call(string $method, string $path = '', array $headers = [], array $params = [])
|
||||
{
|
||||
usleep(50000);
|
||||
$headers = array_merge($this->headers, $headers);
|
||||
$ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : ''));
|
||||
$responseHeaders = [];
|
||||
|
|
@ -187,6 +188,8 @@ class Client
|
|||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
|
||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) {
|
||||
$len = strlen($header);
|
||||
$header = explode(':', $header, 2);
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class AccountCustomClientTest extends Scope
|
|||
/**
|
||||
* @depends testCreateAnonymousAccount
|
||||
*/
|
||||
public function testUpdateAnonymousAccountPassword($session):array
|
||||
public function testUpdateAnonymousAccountPassword($session)
|
||||
{
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
@ -278,13 +278,13 @@ class AccountCustomClientTest extends Scope
|
|||
|
||||
$this->assertEquals($response['headers']['status-code'], 400);
|
||||
|
||||
return [];
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testUpdateAnonymousAccountPassword
|
||||
*/
|
||||
public function testUpdateAnonymousAccountEmail($session):array
|
||||
public function testUpdateAnonymousAccountEmail($session)
|
||||
{
|
||||
$email = uniqid().'new@localhost.test';
|
||||
|
||||
|
|
@ -301,12 +301,12 @@ class AccountCustomClientTest extends Scope
|
|||
'password' => '',
|
||||
]);
|
||||
|
||||
$this->assertEquals($response['headers']['status-code'], 401);
|
||||
$this->assertEquals(400, $response['headers']['status-code']);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function testConvertAnonymousAccount():array
|
||||
public function testConvertAnonymousAccount()
|
||||
{
|
||||
$session = $this->testCreateAnonymousAccount();
|
||||
$email = uniqid().'new@localhost.test';
|
||||
|
|
@ -372,7 +372,7 @@ class AccountCustomClientTest extends Scope
|
|||
return [];
|
||||
}
|
||||
|
||||
public function testConvertAnonymousAccountOAuth2():array
|
||||
public function testConvertAnonymousAccountOAuth2()
|
||||
{
|
||||
$session = $this->testCreateAnonymousAccount();
|
||||
$provider = 'mock';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ trait DatabaseBase
|
|||
]);
|
||||
|
||||
$this->assertEquals($actors['headers']['status-code'], 201);
|
||||
$this->assertEquals($actors['body']['$collection'], 0);
|
||||
$this->assertEquals($actors['body']['name'], 'Actors');
|
||||
$this->assertIsArray($actors['body']['$permissions']);
|
||||
$this->assertIsArray($actors['body']['$permissions']['read']);
|
||||
|
|
@ -86,7 +85,6 @@ trait DatabaseBase
|
|||
]);
|
||||
|
||||
$this->assertEquals($movies['headers']['status-code'], 201);
|
||||
$this->assertEquals($movies['body']['$collection'], 0);
|
||||
$this->assertEquals($movies['body']['name'], 'Movies');
|
||||
$this->assertIsArray($movies['body']['$permissions']);
|
||||
$this->assertIsArray($movies['body']['$permissions']['read']);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ class DatabaseCustomServerTest extends Scope
|
|||
]);
|
||||
|
||||
$this->assertEquals($actors['headers']['status-code'], 201);
|
||||
$this->assertEquals($actors['body']['$collection'], 0);
|
||||
$this->assertEquals($actors['body']['name'], 'Actors');
|
||||
$this->assertIsArray($actors['body']['$permissions']);
|
||||
$this->assertIsArray($actors['body']['$permissions']['read']);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
'account.create',
|
||||
'account.delete',
|
||||
],
|
||||
'schedule' => '* * * * *',
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
], [
|
||||
'name' => 'Test',
|
||||
'execute' => ['user:'.$this->getUser()['$id']],
|
||||
'env' => 'php-7.4',
|
||||
'env' => 'php-8.0',
|
||||
'vars' => [
|
||||
'funcKey1' => 'funcValue1',
|
||||
'funcKey2' => 'funcValue2',
|
||||
|
|
@ -64,7 +64,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
'account.create',
|
||||
'account.delete',
|
||||
],
|
||||
'schedule' => '* * * * *',
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], [
|
||||
'command' => 'php function.php',
|
||||
'command' => 'php index.php',
|
||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
]);
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
], [
|
||||
'name' => 'Test',
|
||||
'execute' => ['*'],
|
||||
'env' => 'php-7.4',
|
||||
'env' => 'php-8.0',
|
||||
'vars' => [
|
||||
'funcKey1' => 'funcValue1',
|
||||
'funcKey2' => 'funcValue2',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Tests\E2E\Client;
|
|||
use Tests\E2E\Scopes\ProjectCustom;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideServer;
|
||||
use Utopia\CLI\Console;
|
||||
|
||||
class FunctionsCustomServerTest extends Scope
|
||||
{
|
||||
|
|
@ -25,7 +24,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'name' => 'Test',
|
||||
'env' => 'php-7.4',
|
||||
'env' => 'php-8.0',
|
||||
'vars' => [
|
||||
'funcKey1' => 'funcValue1',
|
||||
'funcKey2' => 'funcValue2',
|
||||
|
|
@ -35,7 +34,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'account.create',
|
||||
'account.delete',
|
||||
],
|
||||
'schedule' => '* * * * *',
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
$this->assertEquals(201, $response1['headers']['status-code']);
|
||||
$this->assertNotEmpty($response1['body']['$id']);
|
||||
$this->assertEquals('Test', $response1['body']['name']);
|
||||
$this->assertEquals('php-7.4', $response1['body']['env']);
|
||||
$this->assertEquals('php-8.0', $response1['body']['env']);
|
||||
$this->assertIsInt($response1['body']['dateCreated']);
|
||||
$this->assertIsInt($response1['body']['dateUpdated']);
|
||||
$this->assertEquals('', $response1['body']['tag']);
|
||||
|
|
@ -57,7 +56,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'account.create',
|
||||
'account.delete',
|
||||
], $response1['body']['events']);
|
||||
$this->assertEquals('* * * * *', $response1['body']['schedule']);
|
||||
$this->assertEquals('0 0 1 1 *', $response1['body']['schedule']);
|
||||
$this->assertEquals(10, $response1['body']['timeout']);
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +141,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'account.update.name',
|
||||
'account.update.email',
|
||||
],
|
||||
'schedule' => '* * * * 1',
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 5,
|
||||
]);
|
||||
|
||||
|
|
@ -161,7 +160,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'account.update.name',
|
||||
'account.update.email',
|
||||
], $response1['body']['events']);
|
||||
$this->assertEquals('* * * * 1', $response1['body']['schedule']);
|
||||
$this->assertEquals('0 0 1 1 *', $response1['body']['schedule']);
|
||||
$this->assertEquals(5, $response1['body']['timeout']);
|
||||
|
||||
/**
|
||||
|
|
@ -183,7 +182,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'command' => 'php function.php',
|
||||
'command' => 'php index.php',
|
||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
]);
|
||||
|
||||
|
|
@ -192,7 +191,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
$this->assertEquals(201, $tag['headers']['status-code']);
|
||||
$this->assertNotEmpty($tag['body']['$id']);
|
||||
$this->assertIsInt($tag['body']['dateCreated']);
|
||||
$this->assertEquals('php function.php', $tag['body']['command']);
|
||||
$this->assertEquals('php index.php', $tag['body']['command']);
|
||||
$this->assertGreaterThan(10000, $tag['body']['size']);
|
||||
|
||||
/**
|
||||
|
|
@ -308,28 +307,28 @@ class FunctionsCustomServerTest extends Scope
|
|||
$this->assertEquals('', $execution['body']['stderr']);
|
||||
$this->assertEquals(0, $execution['body']['time']);
|
||||
|
||||
// $execution = $this->client->call(Client::METHOD_GET, '/functions/'.$data['functionId'].'/executions/'.$executionId, array_merge([
|
||||
// 'content-type' => 'application/json',
|
||||
// 'x-appwrite-project' => $this->getProject()['$id'],
|
||||
// ], $this->getHeaders()));
|
||||
sleep(10);
|
||||
|
||||
// $this->assertNotEmpty($execution['body']['$id']);
|
||||
// $this->assertNotEmpty($execution['body']['functionId']);
|
||||
// $this->assertIsInt($execution['body']['dateCreated']);
|
||||
// $this->assertEquals($data['functionId'], $execution['body']['functionId']);
|
||||
// $this->assertEquals('completed', $execution['body']['status']);
|
||||
// $this->assertEquals(0, $execution['body']['exitCode']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_ID', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_NAME', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_TAG', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_TRIGGER', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_ENV_NAME', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('APPWRITE_FUNCTION_ENV_VERSION', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString('Hello World', $execution['body']['stdout']);
|
||||
// $this->assertStringContainsString($execution['body']['functionId'], $execution['body']['stdout']);
|
||||
// $this->assertEquals('', $execution['body']['stderr']);
|
||||
// $this->assertGreaterThan(0.100, $execution['body']['time']);
|
||||
// $this->assertLessThan(0.500, $execution['body']['time']);
|
||||
$execution = $this->client->call(Client::METHOD_GET, '/functions/'.$data['functionId'].'/executions/'.$executionId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertNotEmpty($execution['body']['$id']);
|
||||
$this->assertNotEmpty($execution['body']['functionId']);
|
||||
$this->assertIsInt($execution['body']['dateCreated']);
|
||||
$this->assertEquals($data['functionId'], $execution['body']['functionId']);
|
||||
$this->assertEquals('completed', $execution['body']['status']);
|
||||
$this->assertEquals(0, $execution['body']['exitCode']);
|
||||
$this->assertStringContainsString($execution['body']['functionId'], $execution['body']['stdout']);
|
||||
$this->assertStringContainsString($data['tagId'], $execution['body']['stdout']);
|
||||
$this->assertStringContainsString('Test1', $execution['body']['stdout']);
|
||||
$this->assertStringContainsString('http', $execution['body']['stdout']);
|
||||
$this->assertStringContainsString('PHP', $execution['body']['stdout']);
|
||||
$this->assertStringContainsString('8.0', $execution['body']['stdout']);
|
||||
$this->assertEquals('', $execution['body']['stderr']);
|
||||
$this->assertGreaterThan(0.100, $execution['body']['time']);
|
||||
$this->assertLessThan(0.500, $execution['body']['time']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
@ -451,231 +450,6 @@ class FunctionsCustomServerTest extends Scope
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function testENVS():array
|
||||
{
|
||||
|
||||
$functionsDir = realpath(__DIR__ . '/../../../resources/functions');
|
||||
$envs = require('app/config/environments.php');
|
||||
|
||||
|
||||
/**
|
||||
* Command for rebuilding code packages:
|
||||
* bash tests/resources/functions/package-*.sh
|
||||
*/
|
||||
$functions = [
|
||||
'node-14.5' => [
|
||||
'code' => $functionsDir.'/node.tar.gz',
|
||||
'command' => 'node index.js',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'node-15.5' => [
|
||||
'code' => $functionsDir.'/node.tar.gz',
|
||||
'command' => 'node index.js',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'php-7.4' => [
|
||||
'code' => $functionsDir.'/php.tar.gz',
|
||||
'command' => 'php index.php',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'php-8.0' => [
|
||||
'code' => $functionsDir.'/php.tar.gz',
|
||||
'command' => 'php index.php',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'ruby-2.7' => [
|
||||
'code' => $functionsDir.'/ruby.tar.gz',
|
||||
'command' => 'ruby app.rb',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'ruby-3.0' => [
|
||||
'code' => $functionsDir.'/ruby.tar.gz',
|
||||
'command' => 'ruby app.rb',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'python-3.8' => [
|
||||
'code' => $functionsDir.'/python.tar.gz',
|
||||
'command' => 'python main.py',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'python-3.9' => [
|
||||
'code' => $functionsDir.'/python.tar.gz',
|
||||
'command' => 'python main.py',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'deno-1.2' => [
|
||||
'code' => $functionsDir.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'deno-1.5' => [
|
||||
'code' => $functionsDir.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'deno-1.6' => [
|
||||
'code' => $functionsDir.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'deno-1.8' => [
|
||||
'code' => $functionsDir.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'dart-2.10' => [
|
||||
'code' => $functionsDir.'/dart.tar.gz',
|
||||
'command' => 'dart main.dart',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'dart-2.12' => [
|
||||
'code' => $functionsDir.'/dart.tar.gz',
|
||||
'command' => 'dart main.dart',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'dotnet-3.1' => [
|
||||
'code' => $functionsDir.'/dotnet-3.1.tar.gz',
|
||||
'command' => 'dotnet dotnet.dll',
|
||||
'timeout' => 15,
|
||||
],
|
||||
'dotnet-5.0' => [
|
||||
'code' => $functionsDir.'/dotnet-5.0.tar.gz',
|
||||
'command' => 'dotnet dotnet.dll',
|
||||
'timeout' => 15,
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($envs as $key => $env) {
|
||||
$envs[$key] = array_merge($env, $functions[$key]);
|
||||
}
|
||||
|
||||
sleep(count($envs) * 20);
|
||||
fwrite(STDERR, ".");
|
||||
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
$file = $this->client->call(Client::METHOD_POST, '/storage/files', array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'),
|
||||
'read' => ['*'],
|
||||
'write' => ['*'],
|
||||
'folderId' => 'xyz',
|
||||
]);
|
||||
|
||||
$this->assertEquals($file['headers']['status-code'], 201);
|
||||
$this->assertNotEmpty($file['body']['$id']);
|
||||
|
||||
$fileId = $file['body']['$id'] ?? '';
|
||||
|
||||
foreach ($envs as $key => $env) {
|
||||
$name = $key ?? '';
|
||||
$language = $env['name'] ?? '';
|
||||
$version = $env['version'] ?? '';
|
||||
$code = $env['code'] ?? '';
|
||||
$command = $env['command'] ?? '';
|
||||
$timeout = $env['timeout'] ?? 15;
|
||||
|
||||
$function = $this->client->call(Client::METHOD_POST, '/functions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'name' => 'Test '.$name,
|
||||
'env' => $name,
|
||||
'vars' => [
|
||||
'APPWRITE_ENDPOINT' => 'http://appwrite.test/v1',
|
||||
'APPWRITE_PROJECT' => $this->getProject()['$id'],
|
||||
'APPWRITE_SECRET' => $this->getProject()['apiKey'],
|
||||
'APPWRITE_FILEID' => $fileId,
|
||||
],
|
||||
'events' => [],
|
||||
'schedule' => '',
|
||||
'timeout' => $timeout,
|
||||
]);
|
||||
|
||||
// var_dump('http://'.gethostbyname(trim(`hostname`)).'/v1');
|
||||
|
||||
$functionId = $function['body']['$id'] ?? '';
|
||||
|
||||
$this->assertEquals(201, $function['headers']['status-code']);
|
||||
|
||||
$tag = $this->client->call(Client::METHOD_POST, '/functions/'.$functionId.'/tags', array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'command' => $command,
|
||||
'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||
]);
|
||||
|
||||
$tagId = $tag['body']['$id'] ?? '';
|
||||
$this->assertEquals(201, $tag['headers']['status-code']);
|
||||
|
||||
$tag = $this->client->call(Client::METHOD_PATCH, '/functions/'.$functionId.'/tag', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'tag' => $tagId,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $tag['headers']['status-code']);
|
||||
|
||||
$execution = $this->client->call(Client::METHOD_POST, '/functions/'.$functionId.'/executions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'async' => 1,
|
||||
]);
|
||||
|
||||
$executionId = $execution['body']['$id'] ?? '';
|
||||
$this->assertEquals(201, $execution['headers']['status-code']);
|
||||
|
||||
sleep(10);
|
||||
|
||||
$executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
if($executions['body']['executions'][0]['status'] !== 'completed') {
|
||||
var_dump($env);
|
||||
var_dump($executions['body']['executions'][0]);
|
||||
$stdout = '';
|
||||
$stderr = '';
|
||||
Console::execute('docker logs appwrite-worker-functions', '', $stdout, $stderr);
|
||||
var_dump($stdout);
|
||||
var_dump($stderr);
|
||||
}
|
||||
|
||||
$this->assertEquals($executions['headers']['status-code'], 200);
|
||||
$this->assertEquals($executions['body']['sum'], 1);
|
||||
$this->assertIsArray($executions['body']['executions']);
|
||||
$this->assertCount(1, $executions['body']['executions']);
|
||||
$this->assertEquals($executions['body']['executions'][0]['$id'], $executionId);
|
||||
$this->assertEquals($executions['body']['executions'][0]['trigger'], 'http');
|
||||
$this->assertEquals($executions['body']['executions'][0]['status'], 'completed');
|
||||
$this->assertEquals($executions['body']['executions'][0]['exitCode'], 0);
|
||||
|
||||
$stdout = explode("\n", $executions['body']['executions'][0]['stdout']);
|
||||
|
||||
$this->assertEquals($stdout[0], $functionId);
|
||||
$this->assertEquals($stdout[1], 'Test '.$name);
|
||||
$this->assertEquals($stdout[2], $tagId);
|
||||
$this->assertEquals($stdout[3], 'http');
|
||||
$this->assertEquals($stdout[4], $language);
|
||||
$this->assertEquals($stdout[5], $version);
|
||||
// $this->assertEquals($stdout[6], $fileId);
|
||||
fwrite(STDERR, ".");
|
||||
}
|
||||
|
||||
return [
|
||||
'functionId' => $functionId,
|
||||
];
|
||||
}
|
||||
/**
|
||||
* @depends testENVS
|
||||
*/
|
||||
public function testTimeout()
|
||||
{
|
||||
$name = 'php-8.0';
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ trait LocaleBase
|
|||
$this->assertEquals(194, $response['body']['sum']);
|
||||
$this->assertIsArray($response['body']['phones']);
|
||||
$this->assertEquals($response['body']['phones'][0]['code'], '+1');
|
||||
$this->assertEquals($response['body']['phones'][0]['countryName'], 'United States');
|
||||
$this->assertEquals($response['body']['phones'][0]['countryCode'], 'US');
|
||||
$this->assertEquals($response['body']['phones'][0]['countryName'], 'Canada');
|
||||
$this->assertEquals($response['body']['phones'][0]['countryCode'], 'CA');
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
@ -222,7 +222,7 @@ trait LocaleBase
|
|||
return [];
|
||||
}
|
||||
|
||||
public function testLangaugaes(): array
|
||||
public function testLanguages(): array
|
||||
{
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
|
|
|
|||
|
|
@ -149,6 +149,8 @@ class ProjectsConsoleClientTest extends Scope
|
|||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
|
||||
sleep(30);
|
||||
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ class WebhooksCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'name' => 'Test',
|
||||
'env' => 'php-7.4',
|
||||
'env' => 'php-8.0',
|
||||
'execute' => ['*'],
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
|
@ -348,7 +348,7 @@ class WebhooksCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'name' => 'Test',
|
||||
'env' => 'php-7.4',
|
||||
'env' => 'php-8.0',
|
||||
'execute' => ['*'],
|
||||
'vars' => [
|
||||
'key1' => 'value1',
|
||||
|
|
@ -453,6 +453,7 @@ class WebhooksCustomServerTest extends Scope
|
|||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
|
||||
$execution = $this->client->call(Client::METHOD_POST, '/functions/'.$data['functionId'].'/executions', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
|
@ -472,7 +473,7 @@ class WebhooksCustomServerTest extends Scope
|
|||
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']);
|
||||
|
||||
// wait for timeout function to complete (sleep(5);)
|
||||
sleep(6);
|
||||
sleep(10);
|
||||
|
||||
$webhook = $this->getLastRequest();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import "dart:io";
|
||||
import "package:dart_appwrite/dart_appwrite.dart";
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
client
|
||||
.setEndpoint(Platform.environment["APPWRITE_ENDPOINT"]) // Your API Endpoint
|
||||
.setProject(Platform.environment["APPWRITE_PROJECT"]) // Your project ID
|
||||
.setKey(Platform.environment["APPWRITE_SECRET"]) // Your secret API key
|
||||
;
|
||||
|
||||
Storage storage = Storage(client);
|
||||
|
||||
//Future result = storage.getFile(fileId: '[FILE_ID]');
|
||||
|
||||
print(Platform.environment["APPWRITE_FUNCTION_ID"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_NAME"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_TAG"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_TRIGGER"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_ENV_NAME"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_ENV_VERSION"]);
|
||||
// print(result['$id']);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_EVENT"]);
|
||||
print(Platform.environment["APPWRITE_FUNCTION_EVENT_DATA"]);
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
name: appwrite_cloud_function_demo
|
||||
version: 0.1.0
|
||||
description: Demo cloud function script.
|
||||
environment:
|
||||
sdk: '>=2.10.0 <3.0.0'
|
||||
dependencies:
|
||||
dart_appwrite: ^0.1.0
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
|
||||
let client = new sdk.Client();
|
||||
|
||||
client
|
||||
.setEndpoint(Deno.env.get("APPWRITE_ENDPOINT") || '') // Your API Endpoint
|
||||
.setProject(Deno.env.get("APPWRITE_PROJECT") || '') // Your project ID
|
||||
.setKey(Deno.env.get("APPWRITE_SECRET") || '') // Your secret API key
|
||||
;
|
||||
|
||||
let storage = new sdk.Storage(client);
|
||||
|
||||
// let result = storage.getFile(Deno.env.get("APPWRITE_FILEID"));
|
||||
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_ID") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_NAME") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_TAG") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_TRIGGER") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_ENV_NAME") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_ENV_VERSION") || '');
|
||||
// console.log(result['$id']"));
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_EVENT") || '');
|
||||
console.log(Deno.env.get("APPWRITE_FUNCTION_EVENT_DATA") || '');
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
using Appwrite;
|
||||
|
||||
namespace dotnet
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Client client = new Client();
|
||||
|
||||
client.SetEndPoint(Environment.GetEnvironmentVariable("APPWRITE_ENDPOINT"));
|
||||
client.SetProject(Environment.GetEnvironmentVariable("APPWRITE_PROJECT"));
|
||||
client.SetKey(Environment.GetEnvironmentVariable("APPWRITE_SECRET"));
|
||||
|
||||
Storage storage = new Storage(client);
|
||||
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ID"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_NAME"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TAG"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TRIGGER"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_NAME"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_VERSION"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT_DATA"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Appwrite" Version="0.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
using Appwrite;
|
||||
|
||||
namespace dotnet
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Client client = new Client();
|
||||
|
||||
client.SetEndPoint(Environment.GetEnvironmentVariable("APPWRITE_ENDPOINT"));
|
||||
client.SetProject(Environment.GetEnvironmentVariable("APPWRITE_PROJECT"));
|
||||
client.SetKey(Environment.GetEnvironmentVariable("APPWRITE_SECRET"));
|
||||
|
||||
Storage storage = new Storage(client);
|
||||
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ID"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_NAME"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TAG"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_TRIGGER"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_NAME"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_ENV_VERSION"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT"));
|
||||
Console.WriteLine(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_EVENT_DATA"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Appwrite" Version="0.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
const sdk = require('node-appwrite');
|
||||
|
||||
let client = new sdk.Client();
|
||||
|
||||
client
|
||||
.setEndpoint(process.env.APPWRITE_ENDPOINT) // Your API Endpoint
|
||||
.setProject(process.env.APPWRITE_PROJECT) // Your project ID
|
||||
.setKey(process.env.APPWRITE_SECRET) // Your secret API key
|
||||
;
|
||||
|
||||
let storage = new sdk.Storage(client);
|
||||
|
||||
// let result = storage.getFile(process.env.APPWRITE_FILEID);
|
||||
|
||||
console.log(process.env.APPWRITE_FUNCTION_ID);
|
||||
console.log(process.env.APPWRITE_FUNCTION_NAME);
|
||||
console.log(process.env.APPWRITE_FUNCTION_TAG);
|
||||
console.log(process.env.APPWRITE_FUNCTION_TRIGGER);
|
||||
console.log(process.env.APPWRITE_FUNCTION_ENV_NAME);
|
||||
console.log(process.env.APPWRITE_FUNCTION_ENV_VERSION);
|
||||
// console.log(result['$id']);
|
||||
console.log(process.env.APPWRITE_FUNCTION_EVENT);
|
||||
console.log(process.env.APPWRITE_FUNCTION_EVENT_DATA);
|
||||
376
tests/resources/functions/node/package-lock.json
generated
|
|
@ -1,376 +0,0 @@
|
|||
{
|
||||
"name": "appwrite-cloud-function-demo",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.4",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
||||
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
|
||||
"requires": {
|
||||
"safer-buffer": "~2.1.0"
|
||||
}
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
|
||||
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
|
||||
"requires": {
|
||||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
|
||||
"requires": {
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||
},
|
||||
"extsprintf": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
|
||||
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"getpass": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "5.1.5",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
|
||||
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
|
||||
"requires": {
|
||||
"ajv": "^6.12.3",
|
||||
"har-schema": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
|
||||
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"extsprintf": "1.3.0",
|
||||
"json-schema": "0.2.3",
|
||||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.44.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
|
||||
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.27",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
|
||||
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
|
||||
"requires": {
|
||||
"mime-db": "1.44.0"
|
||||
}
|
||||
},
|
||||
"node-appwrite": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-appwrite/-/node-appwrite-1.1.0.tgz",
|
||||
"integrity": "sha512-ZLOsxmsGry4ZRT63QRbNgUxhYiUzJlQntQL2nKAy6PBL1S/hMCChKrdLIdJv3ytGxPrrIWiDWxXivMeUeCW5KA==",
|
||||
"requires": {
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.7"
|
||||
}
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
||||
},
|
||||
"request": {
|
||||
"version": "2.88.2",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
|
||||
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
|
||||
"requires": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"har-validator": "~5.1.3",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.19",
|
||||
"oauth-sign": "~0.9.0",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.2",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.5.0",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"request-promise-core": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
|
||||
"integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.19"
|
||||
}
|
||||
},
|
||||
"request-promise-native": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz",
|
||||
"integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==",
|
||||
"requires": {
|
||||
"request-promise-core": "1.1.4",
|
||||
"stealthy-require": "^1.1.1",
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
|
||||
"requires": {
|
||||
"asn1": "~0.2.3",
|
||||
"assert-plus": "^1.0.0",
|
||||
"bcrypt-pbkdf": "^1.0.0",
|
||||
"dashdash": "^1.12.0",
|
||||
"ecc-jsbn": "~0.1.1",
|
||||
"getpass": "^0.1.1",
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.0.2",
|
||||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"stealthy-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"requires": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
||||
"integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"core-util-is": "1.0.2",
|
||||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"name": "appwrite-cloud-function-demo",
|
||||
"version": "0.1.0",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": "public",
|
||||
"dependencies": {
|
||||
"node-appwrite": "1.1.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
echo 'Dart Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/dart $(pwd)/tests/resources/functions/packages/dart
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dart:/app -w /app appwrite/env-dart-2.10:1.0.0 ls
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dart:/app -w /app --env PUB_CACHE=./.appwrite appwrite/env-dart-2.10:1.0.0 pub get
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dart:/app -w /app appwrite/env-dart-2.10:1.0.0 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/dart/code.tar.gz $(pwd)/tests/resources/functions/dart.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/dart
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo 'Deno Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/deno $(pwd)/tests/resources/functions/packages/deno
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/deno:/app -w /app appwrite/env-deno-1.5:1.0.0 ls
|
||||
docker run --rm --env DENO_DIR=./.appwrite -v $(pwd)/tests/resources/functions/packages/deno:/app -w /app appwrite/env-deno-1.5:1.0.0 deno cache index.ts
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/deno:/app -w /app appwrite/env-deno-1.5:1.0.0 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/deno/code.tar.gz $(pwd)/tests/resources/functions/deno.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/deno
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo '.NET 3.1 Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/dotnet-3.1 $(pwd)/tests/resources/functions/packages/dotnet-3.1
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app mcr.microsoft.com/dotnet/sdk:3.1-alpine dotnet restore
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app mcr.microsoft.com/dotnet/sdk:3.1-alpine dotnet publish -o ./release
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-3.1:/app -w /app/release appwrite/env-dotnet-3.1:1.0.0 tar -zcvf ../code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/dotnet-3.1/code.tar.gz $(pwd)/tests/resources/functions/dotnet-3.1.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/dotnet-3.1
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo '.NET 5.0 Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/dotnet-5.0 $(pwd)/tests/resources/functions/packages/dotnet-5.0
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app mcr.microsoft.com/dotnet/sdk:5.0-alpine dotnet restore
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app mcr.microsoft.com/dotnet/sdk:5.0-alpine dotnet publish -o ./release
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dotnet-5.0:/app -w /app/release appwrite/env-dotnet-5.0:1.0.0 tar -zcvf ../code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/dotnet-5.0/code.tar.gz $(pwd)/tests/resources/functions/dotnet-5.0.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/dotnet-5.0
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo 'Node Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/node $(pwd)/tests/resources/functions/packages/node
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/node:/app -w /app appwrite/env-node-14.5:1.0.0 npm install
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/node:/app -w /app appwrite/env-node-14.5:1.0.0 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/node/code.tar.gz $(pwd)/tests/resources/functions/node.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/node
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo 'Python Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/python $(pwd)/tests/resources/functions/packages/python
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/python:/app -w /app --env PIP_TARGET=./.appwrite appwrite/env-python-3.8:1.0.0 pip install -r ./requirements.txt --upgrade --ignore-installed
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/python:/app -w /app appwrite/env-python-3.8:1.0.0 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/python/code.tar.gz $(pwd)/tests/resources/functions/python.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/python
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
echo 'Ruby Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/ruby $(pwd)/tests/resources/functions/packages/ruby
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/ruby:/app -w /app --env GEM_HOME=./.appwrite appwrite/env-ruby-2.7:1.0.2 bundle install
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/ruby:/app -w /app appwrite/env-ruby-2.7:1.0.2 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/ruby/code.tar.gz $(pwd)/tests/resources/functions/ruby.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/ruby
|
||||
|
|
@ -21,8 +21,8 @@ echo $_ENV['APPWRITE_FUNCTION_ID']."\n";
|
|||
echo $_ENV['APPWRITE_FUNCTION_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_TAG']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_TRIGGER']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_ENV_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_ENV_VERSION']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_RUNTIME_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_RUNTIME_VERSION']."\n";
|
||||
// echo $result['$id'];
|
||||
echo $_ENV['APPWRITE_FUNCTION_EVENT']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_EVENT_DATA']."\n";
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ echo $_ENV['APPWRITE_FUNCTION_ID']."\n";
|
|||
echo $_ENV['APPWRITE_FUNCTION_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_TAG']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_TRIGGER']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_ENV_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_ENV_VERSION']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_RUNTIME_NAME']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_RUNTIME_VERSION']."\n";
|
||||
// echo $result['$id'];
|
||||
echo $_ENV['APPWRITE_FUNCTION_EVENT']."\n";
|
||||
echo $_ENV['APPWRITE_FUNCTION_EVENT_DATA']."\n";
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import json
|
||||
import os
|
||||
from appwrite.client import Client
|
||||
from appwrite.services.storage import Storage
|
||||
|
||||
# Setup appwrite client
|
||||
client = Client()
|
||||
client.set_endpoint(os.environ["APPWRITE_ENDPOINT"]) # PRIVATE IP OF YOUR APPWRITE CONTAINER
|
||||
client.set_project(os.environ["APPWRITE_PROJECT"]) # YOUR PROJECT ID
|
||||
client.set_key(os.environ["APPWRITE_SECRET"])
|
||||
|
||||
storage = Storage(client)
|
||||
# result = storage.get_file(os.environ["APPWRITE_FILEID"])
|
||||
|
||||
print(os.environ["APPWRITE_FUNCTION_ID"])
|
||||
print(os.environ["APPWRITE_FUNCTION_NAME"])
|
||||
print(os.environ["APPWRITE_FUNCTION_TAG"])
|
||||
print(os.environ["APPWRITE_FUNCTION_TRIGGER"])
|
||||
print(os.environ["APPWRITE_FUNCTION_ENV_NAME"])
|
||||
print(os.environ["APPWRITE_FUNCTION_ENV_VERSION"])
|
||||
# print(result["$id"])
|
||||
print(os.environ["APPWRITE_FUNCTION_EVENT"])
|
||||
print(os.environ["APPWRITE_FUNCTION_EVENT_DATA"])
|
||||
|
|
@ -1 +0,0 @@
|
|||
appwrite
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
ruby "~> 2.7.0"
|
||||
|
||||
gem 'appwrite', '~> 1.0', '>= 1.0.11'
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
appwrite (1.0.11)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
appwrite (~> 1.0, >= 1.0.11)
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.7.2p137
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
require 'appwrite'
|
||||
|
||||
client = Appwrite::Client.new()
|
||||
|
||||
client
|
||||
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
|
||||
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
|
||||
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
|
||||
;
|
||||
|
||||
storage = Appwrite::Storage.new(client);
|
||||
|
||||
# result = storage.get_file(ENV["APPWRITE_FILEID"]);
|
||||
|
||||
puts ENV["APPWRITE_FUNCTION_ID"]
|
||||
puts ENV["APPWRITE_FUNCTION_NAME"]
|
||||
puts ENV["APPWRITE_FUNCTION_TAG"]
|
||||
puts ENV["APPWRITE_FUNCTION_TRIGGER"]
|
||||
puts ENV["APPWRITE_FUNCTION_ENV_NAME"]
|
||||
puts ENV["APPWRITE_FUNCTION_ENV_VERSION"]
|
||||
# puts result["$id"]
|
||||
puts ENV["APPWRITE_FUNCTION_EVENT"]
|
||||
puts ENV["APPWRITE_FUNCTION_EVENT_DATA"]
|
||||
|
|
@ -19,8 +19,8 @@ class CollectionsTest extends TestCase
|
|||
|
||||
public function testDuplicateRules()
|
||||
{
|
||||
foreach ($this->collections as $collection) {
|
||||
if ($collection['rules']) {
|
||||
foreach ($this->collections as $key => $collection) {
|
||||
if (array_key_exists('rules', $collection)) {
|
||||
foreach ($collection['rules'] as $check) {
|
||||
$occurences = 0;
|
||||
foreach ($collection['rules'] as $rule) {
|
||||
|
|
|
|||