1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00

Merge pull request #798 from appwrite/fix-797-clamav-env-vars

Fix 797 ClamAV new env vars
This commit is contained in:
Eldad A. Fux 2021-01-02 23:17:15 +02:00 committed by GitHub
commit f31bb4106c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 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

@ -51,6 +51,7 @@
- Upgraded Influxdb Docker image to version 1.8 (alpine)
- Added option to disable mail sending by setting empty SMTP host
- Upgraded installation script ([#490](https://github.com/appwrite/appwrite/issues/490))
- Added new environment variables for ClamAV hostname and port ([#780](https://github.com/appwrite/appwrite/pull/780))
- Added toggle to hide/show secret keys and passwords inside the dashboard (@kodumbeats, [#535](https://github.com/appwrite/appwrite/issues/535))
## Breaking Changes (Read before upgrading!)

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

@ -257,7 +257,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

@ -92,6 +92,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