summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/ServiceProvider/DatabaseProvider.php10
-rw-r--r--app/common.php51
-rw-r--r--app/constants.php3
3 files changed, 39 insertions, 25 deletions
diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php
index d323807d..26662b8a 100644
--- a/app/ServiceProvider/DatabaseProvider.php
+++ b/app/ServiceProvider/DatabaseProvider.php
@@ -10,6 +10,13 @@ use PicoDb\Database;
class DatabaseProvider implements ServiceProviderInterface
{
+ /**
+ * Register provider
+ *
+ * @access public
+ * @param Container $container
+ * @return Container
+ */
public function register(Container $container)
{
$container['db'] = $this->getInstance();
@@ -83,6 +90,9 @@ class DatabaseProvider implements ServiceProviderInterface
'database' => DB_NAME,
'charset' => 'utf8',
'port' => DB_PORT,
+ 'ssl_key' => DB_SSL_KEY,
+ 'ssl_ca' => DB_SSL_CA,
+ 'ssl_cert' => DB_SSL_CERT,
));
}
diff --git a/app/common.php b/app/common.php
index aed07a50..fa95773b 100644
--- a/app/common.php
+++ b/app/common.php
@@ -2,16 +2,17 @@
require __DIR__.'/../vendor/autoload.php';
-// Automatically parse environment configuration (Heroku)
-if (getenv('DATABASE_URL')) {
- $dbopts = parse_url(getenv('DATABASE_URL'));
-
- define('DB_DRIVER', $dbopts['scheme']);
- define('DB_USERNAME', $dbopts["user"]);
- define('DB_PASSWORD', $dbopts["pass"]);
- define('DB_HOSTNAME', $dbopts["host"]);
- define('DB_PORT', isset($dbopts["port"]) ? $dbopts["port"] : null);
- define('DB_NAME', ltrim($dbopts["path"], '/'));
+$dbUrlParser = new PicoDb\UrlParser();
+
+if ($dbUrlParser->isEnvironmentVariableDefined()) {
+ $dbSettings = $dbUrlParser->getSettings();
+
+ define('DB_DRIVER', $dbSettings['driver']);
+ define('DB_USERNAME', $dbSettings['username']);
+ define('DB_PASSWORD', $dbSettings['password']);
+ define('DB_HOSTNAME', $dbSettings['hostname']);
+ define('DB_PORT', $dbSettings['port']);
+ define('DB_NAME', $dbSettings['database']);
}
$config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'config.php'));
@@ -30,18 +31,18 @@ require __DIR__.'/constants.php';
require __DIR__.'/check_setup.php';
$container = new Pimple\Container;
-$container->register(new Kanboard\ServiceProvider\HelperProvider);
-$container->register(new Kanboard\ServiceProvider\SessionProvider);
-$container->register(new Kanboard\ServiceProvider\LoggingProvider);
-$container->register(new Kanboard\ServiceProvider\DatabaseProvider);
-$container->register(new Kanboard\ServiceProvider\AuthenticationProvider);
-$container->register(new Kanboard\ServiceProvider\NotificationProvider);
-$container->register(new Kanboard\ServiceProvider\ClassProvider);
-$container->register(new Kanboard\ServiceProvider\EventDispatcherProvider);
-$container->register(new Kanboard\ServiceProvider\GroupProvider);
-$container->register(new Kanboard\ServiceProvider\RouteProvider);
-$container->register(new Kanboard\ServiceProvider\ActionProvider);
-$container->register(new Kanboard\ServiceProvider\ExternalLinkProvider);
-$container->register(new Kanboard\ServiceProvider\AvatarProvider);
-$container->register(new Kanboard\ServiceProvider\FilterProvider);
-$container->register(new Kanboard\ServiceProvider\PluginProvider);
+$container->register(new Kanboard\ServiceProvider\HelperProvider());
+$container->register(new Kanboard\ServiceProvider\SessionProvider());
+$container->register(new Kanboard\ServiceProvider\LoggingProvider());
+$container->register(new Kanboard\ServiceProvider\DatabaseProvider());
+$container->register(new Kanboard\ServiceProvider\AuthenticationProvider());
+$container->register(new Kanboard\ServiceProvider\NotificationProvider());
+$container->register(new Kanboard\ServiceProvider\ClassProvider());
+$container->register(new Kanboard\ServiceProvider\EventDispatcherProvider());
+$container->register(new Kanboard\ServiceProvider\GroupProvider());
+$container->register(new Kanboard\ServiceProvider\RouteProvider());
+$container->register(new Kanboard\ServiceProvider\ActionProvider());
+$container->register(new Kanboard\ServiceProvider\ExternalLinkProvider());
+$container->register(new Kanboard\ServiceProvider\AvatarProvider());
+$container->register(new Kanboard\ServiceProvider\FilterProvider());
+$container->register(new Kanboard\ServiceProvider\PluginProvider());
diff --git a/app/constants.php b/app/constants.php
index 7ee3f16d..94086fa9 100644
--- a/app/constants.php
+++ b/app/constants.php
@@ -34,6 +34,9 @@ defined('DB_PASSWORD') or define('DB_PASSWORD', '');
defined('DB_HOSTNAME') or define('DB_HOSTNAME', 'localhost');
defined('DB_NAME') or define('DB_NAME', 'kanboard');
defined('DB_PORT') or define('DB_PORT', null);
+defined('DB_SSL_KEY') or define('DB_SSL_KEY', null);
+defined('DB_SSL_CERT') or define('DB_SSL_CERT', null);
+defined('DB_SSL_CA') or define('DB_SSL_CA', null);
// Database backend group provider
defined('DB_GROUP_PROVIDER') or define('DB_GROUP_PROVIDER', true);