-
Notifications
You must be signed in to change notification settings - Fork 13
/
app.php
44 lines (34 loc) · 966 Bytes
/
app.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
<?hh
// Load in external libraries
require 'vendor/autoload.php';
// Set the app's timezone to central
date_default_timezone_set('America/Chicago');
if(!file_exists('config.ini')) {
error_log("Config file does not exist");
die;
}
$configs = parse_ini_file('config.ini', true);
Config::initialize($configs);
// Prepare the databae
DB::$user = $configs['DB']['user'];
DB::$password = $configs['DB']['password'];
DB::$dbName = $configs['DB']['name'];
DB::$port = $configs['DB']['port'];
// Setup email
Email::initialize(new SendGridEmailClient(
$configs['SendGrid']['api_key'],
$configs['SendGrid']['from_email']
));
// Setup Parse
Parse\ParseClient::initialize(
$configs['Parse']['app_id'],
$configs['Parse']['rest_key'],
$configs['Parse']['master_key']
);
// Get the user session going
Session::init();
// Call the dispatcher to do its thing
Route::dispatch(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),
$_SERVER['REQUEST_METHOD']
);