forked from marcqualie/hoard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
executable file
·40 lines (32 loc) · 867 Bytes
/
bootstrap.php
File metadata and controls
executable file
·40 lines (32 loc) · 867 Bytes
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
<?php
date_default_timezone_set('UTC');
// Include Dependencies
include __DIR__ . '/vendor/autoload.php';
// Environment
$app = new Hoard\Application();
$app->env = getenv('APP_ENV') ?: 'development';
$app->config = Hoard\Config::load('default');
// Error Handling
$app->error(function ($e, $code) use ($app) {
if (php_sapi_name() === 'cli')
{
echo $e->getMessage();
exit;
}
$app->router->render($app, 'error', array(
'code' => $code,
'message' => $e->getMessage()
));
});
// Cookies
define('COOKIE_DOMAIN', $app->request->getHost());
define('COOKIE_SECURE', false);
define('COOKIE_HTTP', true);
// Connect to MongoDB
$mongo_client = new MongoMinify\Client(
$app->config['mongo.server'],
$app->config['mongo.options']
);
$app->mongo = $mongo_client->currentDb();
// Return App Instance
return $app;