-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathautoload.php
More file actions
42 lines (34 loc) · 1.74 KB
/
autoload.php
File metadata and controls
42 lines (34 loc) · 1.74 KB
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
<?php
declare(strict_types=1);
namespace FediE2EE\PKDServer;
use FediE2EE\PKDServer\Dependency\InjectConfigStrategy;
/**
* This file should be loaded first.
*/
const PKD_SERVER_ROOT = __DIR__;
// Ensure composer is loaded
require_once PKD_SERVER_ROOT . '/vendor/autoload.php';
// We load this config and store it in a global variable for use in public/index.php
$GLOBALS['pkdConfig'] = new ServerConfig(require_once PKD_SERVER_ROOT . '/config/params.php')
->withAuxDataRegistry(require_once PKD_SERVER_ROOT . '/config/aux-type-registry.php')
->withAuxDataTypeAllowList(require_once PKD_SERVER_ROOT . '/config/aux-type-allow-list.php')
->withCACertFetch(require_once PKD_SERVER_ROOT . '/config/certainty.php')
->withCipherSweet(require_once PKD_SERVER_ROOT . '/config/ciphersweet.php')
->withDatabase(require_once PKD_SERVER_ROOT . '/config/database.php')
->withRouter(require_once PKD_SERVER_ROOT . '/config/routes.php')
->withHPKE(require_once PKD_SERVER_ROOT . '/config/hpke.php')
->withSigningKeys(require_once PKD_SERVER_ROOT . '/config/signing-keys.php')
->withTwig(require_once PKD_SERVER_ROOT . '/config/twig.php')
;
// We have to guarantee `$GLOBALS['pkdConfig']` exists before calling logger.php
$GLOBALS['pkdConfig']
->withLogger(require_once PKD_SERVER_ROOT . '/config/logs.php');
// Optional dependencies go last:
$GLOBALS['pkdConfig']
->withOptionalRedisClient(require_once PKD_SERVER_ROOT . '/config/redis.php');
// Set rate-limiting policy after Redis but before the router:
$GLOBALS['pkdConfig']->withRateLimit(require_once PKD_SERVER_ROOT . '/config/rate-limiting.php');
// Set the config injection strategy to the router
$GLOBALS['pkdConfig']
->getRouter()
->setStrategy(new InjectConfigStrategy());