Last active
March 11, 2021 04:26
-
-
Save camfindlay/35e7df01b7e1eea4094c to your computer and use it in GitHub Desktop.
SilverStripe database setup on Heroku.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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.