Merge branch 'feat-db-pools' of github.com:appwrite/appwrite into feat-add-console

This commit is contained in:
Christy Jacob
2022-11-17 23:27:26 +05:30
9 changed files with 48 additions and 65 deletions
+10 -10
View File
@@ -7,9 +7,9 @@ use Utopia\App;
use Utopia\Cache\Cache;
use Utopia\Config\Config;
use Utopia\Cache\Adapter\Sharding;
use Utopia\CLI\Console;
use Utopia\Database\Database;
use Utopia\Storage\Device;
use Utopia\Storage\Storage;
use Utopia\Storage\Device\Local;
use Utopia\Storage\Device\DOSpaces;
use Utopia\Storage\Device\Linode;
@@ -19,6 +19,7 @@ use Utopia\Storage\Device\S3;
use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization;
use Utopia\DSN\DSN;
use Utopia\Storage\Storage;
abstract class Worker
{
@@ -280,7 +281,7 @@ abstract class Worker
$connection = App::getEnv('_APP_CONNECTIONS_STORAGE', '');
$acl = 'private';
$device = STORAGE_DEVICE_LOCAL;
$device = Storage::DEVICE_LOCAL;
$accessKey = '';
$accessSecret = '';
$bucket = '';
@@ -294,22 +295,21 @@ abstract class Worker
$bucket = $dsn->getPath();
$region = $dsn->getParam('region');
} catch (\Exception $e) {
Console::error($e->getMessage() . 'Invalid DSN. Defaulting to Local storage.');
$device = STORAGE_DEVICE_LOCAL;
Console::error($e->getMessage() . 'Invalid DSN. Defaulting to Local device.');
}
switch ($device) {
case STORAGE_DEVICE_S3:
case Storage::DEVICE_S3:
return new S3($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case STORAGE_DEVICE_DO_SPACES:
case STORAGE::DEVICE_DO_SPACES:
return new DOSpaces($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case STORAGE_DEVICE_BACKBLAZE:
case Storage::DEVICE_BACKBLAZE:
return new Backblaze($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case STORAGE_DEVICE_LINODE:
case Storage::DEVICE_LINODE:
return new Linode($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case STORAGE_DEVICE_WASABI:
case Storage::DEVICE_WASABI:
return new Wasabi($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case STORAGE_DEVICE_LOCAL:
case Storage::DEVICE_LOCAL:
default:
return new Local($root);
}