Merge pull request #8947 from appwrite/feat-configurable-compression-minimum-size

feat: configurable compression minimum size
This commit is contained in:
Christy Jacob 2024-11-08 20:20:55 +01:00 committed by GitHub
commit cf55bf95ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 12 deletions

1
.env
View file

@ -2,6 +2,7 @@ _APP_ENV=development
_APP_EDITION=self-hosted _APP_EDITION=self-hosted
_APP_LOCALE=en _APP_LOCALE=en
_APP_WORKER_PER_CORE=6 _APP_WORKER_PER_CORE=6
_APP_COMPRESSION_MIN_SIZE_BYTES=1024
_APP_CONSOLE_WHITELIST_ROOT=disabled _APP_CONSOLE_WHITELIST_ROOT=disabled
_APP_CONSOLE_WHITELIST_EMAILS= _APP_CONSOLE_WHITELIST_EMAILS=
_APP_CONSOLE_SESSION_ALERTS=enabled _APP_CONSOLE_SESSION_ALERTS=enabled

View file

@ -61,6 +61,7 @@ include __DIR__ . '/controllers/general.php';
$http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $register) { $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $register) {
$app = new App('UTC'); $app = new App('UTC');
$app->setCompression(true); $app->setCompression(true);
$app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB
go(function () use ($register, $app) { go(function () use ($register, $app) {
$pools = $register->get('pools'); $pools = $register->get('pools');
@ -245,6 +246,7 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
$app = new App('UTC'); $app = new App('UTC');
$app->setCompression(true); $app->setCompression(true);
$app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB
$pools = $register->get('pools'); $pools = $register->get('pools');
App::setResource('pools', fn () => $pools); App::setResource('pools', fn () => $pools);

View file

@ -73,6 +73,7 @@ $image = $this->getParam('image', '');
- _APP_ENV - _APP_ENV
- _APP_WORKER_PER_CORE - _APP_WORKER_PER_CORE
- _APP_LOCALE - _APP_LOCALE
- _APP_COMPRESSION_MIN_SIZE_BYTES
- _APP_CONSOLE_WHITELIST_ROOT - _APP_CONSOLE_WHITELIST_ROOT
- _APP_CONSOLE_WHITELIST_EMAILS - _APP_CONSOLE_WHITELIST_EMAILS
- _APP_CONSOLE_SESSION_ALERTS - _APP_CONSOLE_SESSION_ALERTS

24
composer.lock generated
View file

@ -1972,16 +1972,16 @@
}, },
{ {
"name": "utopia-php/framework", "name": "utopia-php/framework",
"version": "0.33.10", "version": "0.33.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/http.git", "url": "https://github.com/utopia-php/http.git",
"reference": "247b934529ab9bcde7d39d6e6212cefcccfc3b20" "reference": "354ff0d23bfc6e82bea0fe8e89e115cff1af8466"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/http/zipball/247b934529ab9bcde7d39d6e6212cefcccfc3b20", "url": "https://api.github.com/repos/utopia-php/http/zipball/354ff0d23bfc6e82bea0fe8e89e115cff1af8466",
"reference": "247b934529ab9bcde7d39d6e6212cefcccfc3b20", "reference": "354ff0d23bfc6e82bea0fe8e89e115cff1af8466",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2012,9 +2012,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/http/issues", "issues": "https://github.com/utopia-php/http/issues",
"source": "https://github.com/utopia-php/http/tree/0.33.10" "source": "https://github.com/utopia-php/http/tree/0.33.11"
}, },
"time": "2024-11-08T15:02:59+00:00" "time": "2024-11-08T18:47:43+00:00"
}, },
{ {
"name": "utopia-php/image", "name": "utopia-php/image",
@ -3560,16 +3560,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.12.0", "version": "1.12.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3608,7 +3608,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/myclabs/DeepCopy/issues", "issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
}, },
"funding": [ "funding": [
{ {
@ -3616,7 +3616,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-12T14:39:25+00:00" "time": "2024-11-08T17:47:46+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",

View file

@ -96,6 +96,7 @@ services:
- _APP_EDITION - _APP_EDITION
- _APP_WORKER_PER_CORE - _APP_WORKER_PER_CORE
- _APP_LOCALE - _APP_LOCALE
- _APP_COMPRESSION_MIN_SIZE_BYTES
- _APP_CONSOLE_WHITELIST_ROOT - _APP_CONSOLE_WHITELIST_ROOT
- _APP_CONSOLE_WHITELIST_EMAILS - _APP_CONSOLE_WHITELIST_EMAILS
- _APP_CONSOLE_SESSION_ALERTS - _APP_CONSOLE_SESSION_ALERTS

View file

@ -62,6 +62,7 @@ services:
- redis - redis
# - clamav # - clamav
environment: environment:
- _APP_COMPRESSION_MIN_SIZE_BYTES
- _APP_ENV - _APP_ENV
- _APP_OPTIONS_ABUSE - _APP_OPTIONS_ABUSE
- _APP_OPTIONS_ROUTER_PROTECTION - _APP_OPTIONS_ROUTER_PROTECTION