API 1.0.0-rc
This commit is contained in:
28
api/setup/settings/03_database.php
Normal file
28
api/setup/settings/03_database.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
return [
|
||||
'databases' => function() {
|
||||
$arr = [
|
||||
ORM::DEFAULT_CONNECTION => [
|
||||
'type' => 'mysql',
|
||||
'host' => [
|
||||
'name' => $_ENV['MYSQL_HOST'] ?? 'db'
|
||||
],
|
||||
'user' => [
|
||||
'name' => $_ENV['MYSQL_USER'],
|
||||
'password' => $_ENV['MYSQL_PASSWORD']
|
||||
],
|
||||
'name' => $_ENV['MYSQL_DATABASE']
|
||||
]
|
||||
];
|
||||
function toObj($arr) {
|
||||
$obj = (object) $arr;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
$obj->{$k} = toObj($v);
|
||||
}
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
return (object) ['databases' => toObj($arr), 'short_names' => true];
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user