You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
568 B
21 lines
568 B
<?php
|
|
$dbconn = null;
|
|
if(!getenv('DATABASE_URL')){
|
|
$connectionConfig = parse_url(getenv('DATABASE_URL'));
|
|
$host = $connectionConfig['host'];
|
|
$user = $connectionConfig['user'];
|
|
$password = $connectionConfig['pass'];
|
|
$port = $connectionConfig['port'];
|
|
$dbname = trim($connectionConfig['path'],'/');
|
|
$dbconn = pg_connect(
|
|
"host=".$host." ".
|
|
"user=".$user." ".
|
|
"password=".$password." ".
|
|
"port=".$port." ".
|
|
"dbname=".$dbname
|
|
);
|
|
} else {
|
|
$dbconn = pg_connect("host=localhost dbname=phpapi");
|
|
}
|
|
?>
|