<?php

use App\Kernel;

if (preg_match("/theme\//", $_SERVER['REQUEST_URI'])) {
    print file_get_contents(dirname(__FILE__).$_SERVER['REQUEST_URI']);
    exit;
}

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};