1
0
Fork 0
mirror of synced 2024-06-01 02:19:51 +12:00

First commit

This commit is contained in:
Eldad Fux 2021-01-02 21:45:59 +02:00
parent bf7282c04f
commit 7ed759ba0e
7 changed files with 32 additions and 3 deletions

3
.env
View file

@ -15,6 +15,9 @@ _APP_DB_PORT=3306
_APP_DB_SCHEMA=appwrite
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_STORAGE_ANTIVIRUS=enabled
_APP_STORAGE_ANTIVIRUS_HOST=clamav
_APP_STORAGE_ANTIVIRUS_PORT=3310
_APP_INFLUXDB_HOST=influxdb
_APP_INFLUXDB_PORT=8086
_APP_STATSD_HOST=telegraf

View file

@ -77,6 +77,8 @@ ENV _APP_SERVER=swoole \
_APP_OPENSSL_KEY_V1=your-secret-key \
_APP_STORAGE_LIMIT=10000000 \
_APP_STORAGE_ANTIVIRUS=enabled \
_APP_STORAGE_ANTIVIRUS_HOST=clamav \
_APP_STORAGE_ANTIVIRUS_PORT=3310 \
_APP_REDIS_HOST=redis \
_APP_REDIS_PORT=6379 \
_APP_DB_HOST=mariadb \

View file

@ -139,6 +139,24 @@ return [
'required' => false,
'question' => '',
],
[
'name' => '_APP_STORAGE_ANTIVIRUS',
'default' => 'enabled',
'required' => false,
'question' => '',
],
[
'name' => '_APP_STORAGE_ANTIVIRUS_HOST',
'default' => 'clamav',
'required' => false,
'question' => '',
],
[
'name' => '_APP_STORAGE_ANTIVIRUS_PORT',
'default' => '3310',
'required' => false,
'question' => '',
],
[
'name' => '_APP_FUNCTIONS_TIMEOUT',
'default' => '900',

View file

@ -256,7 +256,8 @@ App::get('/v1/health/anti-virus')
throw new Exception('Anitvirus is disabled');
}
$antiVirus = new Network('clamav', 3310);
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
$response->json([
'status' => (@$antiVirus->ping()) ? 'online' : 'offline',

View file

@ -96,7 +96,8 @@ App::post('/v1/storage/files')
$mimeType = $device->getFileMimeType($path); // Get mime-type before compression and encryption
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
$antiVirus = new Network('clamav', 3310);
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
if (!$antiVirus->fileScan($path)) {
$device->delete($path);

View file

@ -113,7 +113,8 @@ $cli
if(App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
try {
$antiVirus = new Network('clamav', 3310);
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
if((@$antiVirus->ping())) {
Console::success('AntiVirus...........connected 👍');

View file

@ -91,6 +91,9 @@ services:
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_STORAGE_ANTIVIRUS
- _APP_STORAGE_ANTIVIRUS_HOST
- _APP_STORAGE_ANTIVIRUS_PORT
- _APP_SMTP_HOST
- _APP_SMTP_PORT
- _APP_SMTP_SECURE