2016-04-30 18:47:48 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-08-07 12:05:20 +03:00
|
|
|
use function Shlinkio\Shlink\Common\env;
|
|
|
|
|
2020-06-20 12:07:15 +03:00
|
|
|
use const Shlinkio\Shlink\Core\DEFAULT_REDIRECT_CACHE_LIFETIME;
|
2020-06-17 20:01:56 +03:00
|
|
|
use const Shlinkio\Shlink\Core\DEFAULT_REDIRECT_STATUS_CODE;
|
2020-02-18 20:54:40 +03:00
|
|
|
use const Shlinkio\Shlink\Core\DEFAULT_SHORT_CODES_LENGTH;
|
2021-08-07 12:05:20 +03:00
|
|
|
use const Shlinkio\Shlink\Core\MIN_SHORT_CODES_LENGTH;
|
|
|
|
|
|
|
|
return (static function (): array {
|
|
|
|
$webhooks = env('VISITS_WEBHOOKS');
|
|
|
|
$shortCodesLength = (int) env('DEFAULT_SHORT_CODES_LENGTH', DEFAULT_SHORT_CODES_LENGTH);
|
|
|
|
$shortCodesLength = $shortCodesLength < MIN_SHORT_CODES_LENGTH ? MIN_SHORT_CODES_LENGTH : $shortCodesLength;
|
2020-02-18 20:54:40 +03:00
|
|
|
|
2021-08-07 12:05:20 +03:00
|
|
|
return [
|
2016-04-30 18:47:48 +03:00
|
|
|
|
2021-08-07 12:05:20 +03:00
|
|
|
'url_shortener' => [
|
|
|
|
'domain' => [
|
|
|
|
'schema' => env('SHORT_DOMAIN_SCHEMA', 'http'),
|
|
|
|
'hostname' => env('SHORT_DOMAIN_HOST', ''),
|
|
|
|
],
|
|
|
|
'validate_url' => (bool) env('VALIDATE_URLS', false), // Deprecated
|
|
|
|
'visits_webhooks' => $webhooks === null ? [] : explode(',', $webhooks),
|
|
|
|
'default_short_codes_length' => $shortCodesLength,
|
|
|
|
'auto_resolve_titles' => (bool) env('AUTO_RESOLVE_TITLES', false),
|
|
|
|
'append_extra_path' => (bool) env('REDIRECT_APPEND_EXTRA_PATH', false),
|
|
|
|
|
|
|
|
// TODO Move these two options to their own config namespace. Maybe "redirects".
|
|
|
|
'redirect_status_code' => (int) env('REDIRECT_STATUS_CODE', DEFAULT_REDIRECT_STATUS_CODE),
|
|
|
|
'redirect_cache_lifetime' => (int) env('REDIRECT_CACHE_LIFETIME', DEFAULT_REDIRECT_CACHE_LIFETIME),
|
2016-05-01 12:21:54 +03:00
|
|
|
],
|
2021-08-07 12:05:20 +03:00
|
|
|
|
|
|
|
];
|
|
|
|
})();
|