generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
54 lines (48 loc) · 2.07 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require './vendor/autoload.php';
/* load environment config */
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
use Illuminate\Database\Capsule\Manager as Capsule;
$data = [
'config_instance' =>
[
'driver' => $_ENV['DB_CONFIG_INSTANCE_DRIVER'],
'host' => $_ENV['DB_CONFIG_INSTANCE_HOST'],
'port' => $_ENV['DB_CONFIG_INSTANCE_PORT'],
'database' => $_ENV['DB_CONFIG_INSTANCE_DATABASE'],
'username' => $_ENV['DB_CONFIG_INSTANCE_USERNAME'],
'password' => $_ENV['DB_CONFIG_INSTANCE_PASSWORD'],
'charset' => $_ENV['DB_CONFIG_INSTANCE_CHARSET'],
'collation' => $_ENV['DB_CONFIG_INSTANCE_COLLATION'],
],
'data_instance' =>
[
'driver' => $_ENV['DB_DATA_INSTANCE_DRIVER'],
'host' => $_ENV['DB_DATA_INSTANCE_HOST'],
'port' => $_ENV['DB_DATA_INSTANCE_PORT'],
'database' => $_ENV['DB_DATA_INSTANCE_DATABASE'],
'username' => $_ENV['DB_DATA_INSTANCE_USERNAME'],
'password' => $_ENV['DB_DATA_INSTANCE_PASSWORD'],
'charset' => $_ENV['DB_DATA_INSTANCE_CHARSET'],
'collation' => $_ENV['DB_DATA_INSTANCE_COLLATION'],
],
'history_instance' =>
[
'driver' => $_ENV['DB_HISTORY_INSTANCE_DRIVER'],
'host' => $_ENV['DB_HISTORY_INSTANCE_HOST'],
'port' => $_ENV['DB_HISTORY_INSTANCE_PORT'],
'database' => $_ENV['DB_HISTORY_INSTANCE_DATABASE'],
'username' => $_ENV['DB_HISTORY_INSTANCE_USERNAME'],
'password' => $_ENV['DB_HISTORY_INSTANCE_PASSWORD'],
'charset' => $_ENV['DB_HISTORY_INSTANCE_CHARSET'],
'collation' => $_ENV['DB_HISTORY_INSTANCE_COLLATION'],
]
];
$capsule = new Capsule;
foreach($data as $name => $config)
{
$capsule->addConnection($config, $name);
}
$capsule->setAsGlobal();
$capsule->bootEloquent();