-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.php
50 lines (42 loc) · 1.35 KB
/
init.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
<?php
// Support DEBUG cookie
error_reporting(0);
if ($_COOKIE['debug'] == 'true') {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
}
require_once("vendor/autoload.php");
include_once("stdlib.php");
spl_autoload_register(function ($class_name) {
if ($class_name != 'EC2RoleForAWSCodeDeploy') {
/** @noinspection PhpIncludeInspection */
include 'classes/' . $class_name . '.php';
}
});
$ini = parse_ini_file("config.ini", true)["lb"];
date_default_timezone_set('America/New_York');
try {
$pdo = new PDO(
'mysql:host=' . $ini['db_host'] . ';dbname=' . $ini['db_name'] . ';charset=utf8mb4',
$ini['db_username'],
$ini['db_password'],
array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::ATTR_PERSISTENT => false
)
);
} catch (Exception $e) {
exit($e);
}
$config = array(
'dbo' => $pdo,
'appName' => 'Liquid Books'
);
// Setup SAML
$samlHelper = new Rybel\backbone\SamlAuthHelper($ini['saml_sp'],
$ini['saml_idp'],
file_get_contents("../certs/idp.cert"),
file_get_contents('../certs/public.crt'),
file_get_contents('../certs/private.pem'),
$_COOKIE['debug'] == 'true');