boot.php 652 Bytes
Newer Older
1 2 3 4 5 6 7 8
<?php

/**
 * Boot the application, loading config and database connection.
 */

declare(strict_types=1);

9
use DetectLanguage\DetectLanguage;
10 11 12 13 14 15
use RedBeanPHP\R;

define('PODUPTIME', microtime(true));

require_once __DIR__ . '/vendor/autoload.php';

16 17 18 19
// Initialise language detection.
DetectLanguage::setApiKey(c('dlkey'));
DetectLanguage::setSecure(true);

20 21 22 23 24 25 26 27 28 29 30 31 32 33
// Set up global DB connection.
R::setup(
    sprintf(
        'pgsql:host=%s;port=%d;dbname=%s',
        c('pghost'),
        c('pgport', 5432),
        c('pgdb')
    ),
    c('pguser'),
    c('pgpass'),
    true
);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);