From a08e15763ca13ac23e8b6c669ffbf52c1f0bfc6f Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 20 Sep 2014 14:38:04 +1200 Subject: [PATCH] Heroku mysql environment --- app/_config.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/_config.php b/app/_config.php index 350b605..f6b9f48 100644 --- a/app/_config.php +++ b/app/_config.php @@ -10,7 +10,19 @@ if (defined('SS_DATABASE_NAME')) { $database = SS_DATABASE_NAME; } -require_once('conf/ConfigureFromEnv.php'); +if(isset($_ENV['CLEARDB_DATABASE_URL'])) { + global $databaseConfig; + + $parts = parse_url($_ENV['CLEARDB_DATABASE_URL']); + + $databaseConfig['type'] = 'MySQLDatabase'; + $databaseConfig['server'] = $parts['host']; + $databaseConfig['username'] = $parts['user']; + $databaseConfig['password'] = $parts['pass']; + $databaseConfig['database'] = trim($parts['path'], '/'); +} else { + require_once('conf/ConfigureFromEnv.php'); +} MySQLDatabase::set_connection_charset('utf8'); @@ -26,7 +38,7 @@ Config::inst()->update('DocumentationViewer', 'check_permission', false); DocumentationViewer::set_edit_link( 'framework', - 'https://github.com/silverstripe/silverstripe-framework/edit/%version%/docs/%lang%/%path%', + 'https://github.com/silverstripe/framework/edit/%version%/docs/%lang%/%path%', array( 'rewritetrunktomaster' => true ) @@ -51,3 +63,5 @@ Config::inst()->update('DocumentationSearch', 'boost_by_path', array( if(file_exists(BASE_PATH . '/.lucene-index')) { DocumentationSearch::set_index(BASE_PATH . '/.lucene-index'); } + +