2016-04-10 02:52:44 -05:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2017-10-12 03:13:20 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-01-01 14:11:53 -06:00
|
|
|
use Laminas\ServiceManager\ServiceManager;
|
2022-04-14 07:22:48 -05:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2019-12-23 03:38:06 -06:00
|
|
|
use Symfony\Component\Lock;
|
2016-04-10 02:52:44 -05:00
|
|
|
|
2024-10-08 01:57:51 -05:00
|
|
|
use function Shlinkio\Shlink\Config\loadEnvVarsFromConfig;
|
|
|
|
use function Shlinkio\Shlink\Core\enumValues;
|
|
|
|
|
2021-09-26 04:20:29 -05:00
|
|
|
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
2020-03-22 11:42:56 -05:00
|
|
|
|
2016-04-10 05:06:28 -05:00
|
|
|
chdir(dirname(__DIR__));
|
|
|
|
|
2016-04-17 13:27:24 -05:00
|
|
|
require 'vendor/autoload.php';
|
2016-04-10 02:52:44 -05:00
|
|
|
|
2024-10-24 02:59:13 -05:00
|
|
|
// Promote env vars from installer or dev config
|
|
|
|
loadEnvVarsFromConfig('config/params/*.php', enumValues(EnvVars::class));
|
2024-10-08 01:57:51 -05:00
|
|
|
|
|
|
|
// This is one of the first files loaded. Configure the timezone and memory limit here
|
2024-10-13 05:24:59 -05:00
|
|
|
ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv());
|
|
|
|
date_default_timezone_set(EnvVars::TIMEZONE->loadFromEnv());
|
2022-04-14 07:22:48 -05:00
|
|
|
|
2019-12-23 04:00:38 -06:00
|
|
|
// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
|
2020-03-22 11:42:56 -05: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 07:02:43 -06:00
|
|
|
}
|
2019-12-23 04:00:38 -06:00
|
|
|
|
2022-04-23 03:32:07 -05:00
|
|
|
return (static function (): ServiceManager {
|
2019-12-27 07:02:43 -06:00
|
|
|
$config = require __DIR__ . '/config.php';
|
|
|
|
$container = new ServiceManager($config['dependencies']);
|
|
|
|
$container->setService('config', $config);
|
|
|
|
|
|
|
|
return $container;
|
|
|
|
})();
|