Skip to content

Instantly share code, notes, and snippets.

@zaidaldabbagh
Forked from camfindlay/SilverStripe on Heroku
Last active March 13, 2021 20:09
Show Gist options
  • Save zaidaldabbagh/1f0a8abca7fe99caf363dea0a3df9c54 to your computer and use it in GitHub Desktop.
Save zaidaldabbagh/1f0a8abca7fe99caf363dea0a3df9c54 to your computer and use it in GitHub Desktop.
SilverStripe database setup on Heroku.
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"silverstripe/cms": "3.1.*@stable",
"silverstripe/framework": "3.1.*@stable",
"silverstripe-themes/simple": "*"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
},
"config": {
"process-timeout": 600
},
"minimum-stability": "dev"
}
mysite/_config.php
<?php
// . . . config above
//Heroku ClearDB support
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'], '/');
Security::setDefaultAdmin('heroku', 'yesletmeinplease');
} else {
//Default SilverStripe environement support
require_once('conf/ConfigureFromEnv.php');
}
// Config below . . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment