Created
May 30, 2014 04:36
-
-
Save vs0uz4/eda670ece6fbb02f8b1a to your computer and use it in GitHub Desktop.
Database Configuration File for Laravel
This file contains 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
<?php | |
if (App::environment('production')) { | |
$url = parse_url(getenv("CLEARDB_DATABASE_URL")); | |
putenv("DATABASE_HOST=$url["host"]"); | |
putenv("DATABASE_USERNAME=$url["user"]"); | |
putenv("DATABASE_PASSWORD=$url["pass"]"); | |
putenv("DATABASE_DATABASE=substr($url["path"], 1)"); | |
} | |
return array( | |
'fetch' => PDO::FETCH_CLASS, | |
'default' => 'mysql', | |
'connections' => array( | |
'sqlite' => array( | |
'driver' => 'sqlite', | |
'database' => __DIR__ . '/../database/production.sqlite', | |
'prefix' => '', | |
), | |
'mysql' => array( | |
'driver' => 'mysql', | |
'host' => getenv('DATABASE_HOST'), | |
'database' => getenv('DATABASE_DATABASE'), | |
'username' => getenv('DATABASE_USERNAME'), | |
'password' => getenv('DATABASE_PASSWORD'), | |
'charset' => 'utf8', | |
'collation' => 'utf8_unicode_ci', | |
'prefix' => '', | |
), | |
'pgsql' => array( | |
'driver' => 'pgsql', | |
'host' => 'localhost', | |
'database' => 'database', | |
'username' => 'root', | |
'password' => '', | |
'charset' => 'utf8', | |
'prefix' => '', | |
'schema' => 'public', | |
), | |
'sqlsrv' => array( | |
'driver' => 'sqlsrv', | |
'host' => 'localhost', | |
'database' => 'database', | |
'username' => 'root', | |
'password' => '', | |
'prefix' => '', | |
), | |
), | |
'migrations' => 'migrations', | |
'redis' => array( | |
'cluster' => false, | |
'default' => array( | |
'host' => '127.0.0.1', | |
'port' => 6379, | |
'database' => 0, | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment