1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

feat: added check for env variable on startup

This commit is contained in:
Christy Jacob 2020-12-30 00:12:03 +05:30
parent d67bcec7b9
commit 2ffb34fab1
4 changed files with 11 additions and 1 deletions

1
.env
View file

@ -27,3 +27,4 @@ _APP_SMTP_PASSWORD=
_APP_STORAGE_LIMIT=10000000
_APP_FUNCTIONS_TIMEOUT=900
_APP_FUNCTIONS_CONTAINERS=10
_APP_SYSTEM_RESPONSE_FORMAT=0.6

View file

@ -93,7 +93,8 @@ ENV _APP_SERVER=swoole \
_APP_FUNCTIONS_TIMEOUT=900 \
_APP_FUNCTIONS_CONTAINERS=10 \
_APP_SETUP=self-hosted \
_APP_VERSION=$VERSION
_APP_VERSION=$VERSION \
_APP_SYSTEM_RESPONSE_FORMAT=0.6
#ENV _APP_SMTP_SECURE ''
#ENV _APP_SMTP_USERNAME ''
#ENV _APP_SMTP_PASSWORD ''

View file

@ -23,6 +23,7 @@ error_reporting(E_ALL);
$http = new Server("0.0.0.0", 80);
$payloadSize = max(4000000 /* 4mb */, App::getEnv('_APP_STORAGE_LIMIT', 10000000 /* 10mb */));
$responseFormat = App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', null);
$http
->set([
@ -48,6 +49,12 @@ $http->on('AfterReload', function($serv, $workerId) {
});
$http->on('start', function (Server $http) use ($payloadSize) {
if(empty($responseFormat)) {
Console::error('Missing value for environment variable _APP_SYSTEM_RESPONSE_FORMAT. Exiting ...');
exit(1);
}
Console::success('Server started succefully (max payload is '.number_format($payloadSize).' bytes)');
Console::info("Master pid {$http->master_pid}, manager pid {$http->manager_pid}");

View file

@ -102,6 +102,7 @@ services:
- _APP_STORAGE_LIMIT
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_CONTAINERS
- _APP_SYSTEM_RESPONSE_FORMAT
appwrite-worker-usage:
entrypoint: worker-usage