feat: added check for env variable on startup
This commit is contained in:
parent
d67bcec7b9
commit
2ffb34fab1
1
.env
1
.env
|
@ -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
|
||||
|
|
|
@ -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 ''
|
||||
|
|
|
@ -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}");
|
||||
|
|
|
@ -102,6 +102,7 @@ services:
|
|||
- _APP_STORAGE_LIMIT
|
||||
- _APP_FUNCTIONS_TIMEOUT
|
||||
- _APP_FUNCTIONS_CONTAINERS
|
||||
- _APP_SYSTEM_RESPONSE_FORMAT
|
||||
|
||||
appwrite-worker-usage:
|
||||
entrypoint: worker-usage
|
||||
|
|
Loading…
Reference in a new issue