diff --git a/app/config/variables.php b/app/config/variables.php index 87e73dddae..6c3fb4ae16 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -287,25 +287,7 @@ return [ 'required' => false, 'question' => '', 'filter' => 'password' - ], - [ - 'name' => '_APP_DB_PROJECT', - 'description' => 'A list of comma separated key value pairs for Project DBs where key is the database name and value is the DSN connection string. Example: db_fra1_01=mysql://user:password@112.145.123.1:3306/appwrite, db_fra1_02=mysql://user:password@112.145.123.5:3306/appwrite', - 'introduction' => '0.16.0', - 'default' => 'db_fra1_02=mysql://user:password@mariadb:3306/appwrite', - 'required' => true, - 'question' => '', - 'filter' => '' - ], - [ - 'name' => '_APP_DB_CONSOLE', - 'introduction' => '0.16.0', - 'description' => 'A key value pair representing the console DB where key is the database name and value is the DSN connection string. Example: db_fra1_01=mysql://user:password@112.145.123.1:3306/appwrite', - 'default' => 'db_fra1_01=mysql://user:password@mariadb:3306/appwrite', - 'required' => true, - 'question' => '', - 'filter' => '' - ], + ] ], ], [ diff --git a/app/init.php b/app/init.php index 330d450447..f4865df9fe 100644 --- a/app/init.php +++ b/app/init.php @@ -53,10 +53,13 @@ use Appwrite\Database\DatabasePool; use Appwrite\Event\Delete; use Utopia\Database\Validator\Structure; use Utopia\Database\Validator\Authorization; +use Utopia\Cache\Cache; +use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Validator\Range; use Utopia\Validator\WhiteList; use Swoole\Database\RedisConfig; use Swoole\Database\RedisPool; +use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Query; use Utopia\Storage\Device; use Utopia\Storage\Storage; @@ -858,6 +861,26 @@ App::setResource('console', function () { ]); }, []); +// App::setResource('dbForProject', function ($db, $cache, Document $project) { +// $cache = new Cache(new RedisCache($cache)); + +// $database = new Database(new MariaDB($db), $cache); +// $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); +// $database->setNamespace("_{$project->getInternalId()}"); + +// return $database; +// }, ['db', 'cache', 'project']); + +// App::setResource('dbForConsole', function ($dbPool, $cache) { +// $cache = new Cache(new RedisCache($cache)); + +// $database = new Database(new MariaDB($db), $cache); +// $database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); +// $database->setNamespace('_console'); + +// return $database; +// }, ['dbPool', 'cache']); + App::setResource('deviceLocal', function () { return new Local(); });