2016-04-10 09:52:44 +02:00
|
|
|
<?php
|
2019-10-05 17:26:10 +02:00
|
|
|
|
2017-10-12 10:13:20 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-01-01 21:11:53 +01:00
|
|
|
use Laminas\ServiceManager\ServiceManager;
|
2022-04-14 14:22:48 +02:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2019-12-23 10:38:06 +01:00
|
|
|
use Symfony\Component\Lock;
|
2016-04-10 09:52:44 +02:00
|
|
|
|
2021-09-26 11:20:29 +02:00
|
|
|
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
2020-03-22 17:42:56 +01:00
|
|
|
|
2016-04-10 12:06:28 +02:00
|
|
|
chdir(dirname(__DIR__));
|
|
|
|
|
2016-04-17 20:27:24 +02:00
|
|
|
require 'vendor/autoload.php';
|
2016-04-10 09:52:44 +02:00
|
|
|
|
2022-04-14 14:22:48 +02:00
|
|
|
// This is one of the first files loaded. Configure the timezone here
|
2022-04-23 12:44:17 +02:00
|
|
|
date_default_timezone_set(EnvVars::TIMEZONE->loadFromEnv(date_default_timezone_get()));
|
2022-04-14 14:22:48 +02:00
|
|
|
|
2019-12-23 11:00:38 +01:00
|
|
|
// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
|
2020-03-22 17:42:56 +01:00
|
|
|
// It needs to be placed here as individual config files will not be loaded once config is cached
|
|
|
|
if (! class_exists(LOCAL_LOCK_FACTORY)) {
|
|
|
|
class_alias(Lock\LockFactory::class, LOCAL_LOCK_FACTORY);
|
2019-12-27 14:02:43 +01:00
|
|
|
}
|
2019-12-23 11:00:38 +01:00
|
|
|
|
2016-04-10 09:52:44 +02:00
|
|
|
// Build container
|
2022-04-23 10:32:07 +02:00
|
|
|
return (static function (): ServiceManager {
|
2019-12-27 14:02:43 +01:00
|
|
|
$config = require __DIR__ . '/config.php';
|
|
|
|
$container = new ServiceManager($config['dependencies']);
|
|
|
|
$container->setService('config', $config);
|
|
|
|
|
|
|
|
return $container;
|
|
|
|
})();
|