Skip to content

Instantly share code, notes, and snippets.

@camfindlay
Last active March 11, 2021 04:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save camfindlay/35e7df01b7e1eea4094c to your computer and use it in GitHub Desktop.
Save camfindlay/35e7df01b7e1eea4094c 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 . . .
@zaidaldabbagh
Copy link

This was handy @camfindlay ... your composer.json configs helped ... I think it just needs "php": "7.3.x" added, for Heroku at least, otherwise latest would be installed.

@camfindlay
Copy link
Author

Glad you found this useful @zaidaldabbagh - long time no see :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment