X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/6065a3af58ca2a4d96134be6f7d533e0189cf590..0630ec4bdb74d50e2cc6353dca9d8c691fe22479:/Controller/MapController.php?ds=inline diff --git a/Controller/MapController.php b/Controller/MapController.php index 193d336..8d38aa6 100644 --- a/Controller/MapController.php +++ b/Controller/MapController.php @@ -11,22 +11,22 @@ namespace Rapsys\PackBundle\Controller; +use Rapsys\PackBundle\Util\MapUtil; +use Rapsys\PackBundle\Util\SluggerUtil; + use Psr\Container\ContainerInterface; -use Symfony\Component\HttpFoundation\HeaderUtils; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Filesystem\Exception\IOExceptionInterface; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\HeaderUtils; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\RequestContext; use Symfony\Contracts\Service\ServiceSubscriberInterface; -use Rapsys\PackBundle\Util\MapUtil; -use Rapsys\PackBundle\Util\SluggerUtil; - /** * {@inheritdoc} */ @@ -53,12 +53,9 @@ class MapController extends AbstractController implements ServiceSubscriberInter [ 'http' => [ #'header' => ['Referer: https://www.openstreetmap.org/'], - 'max_redirects' => 5, - //TODO: set as bundle env config - 'timeout' => (int)ini_get('default_socket_timeout'), - #'user_agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36', - //TODO: set as bundle env config - 'user_agent' => (string)ini_get('user_agent')?:'rapsys_pack/2.0.0', + 'max_redirects' => $_ENV['RAPSYSPACK_REDIRECT'] ?? 20, + 'timeout' => $_ENV['RAPSYSPACK_TIMEOUT'] ?? (($timeout = ini_get('default_socket_timeout')) !== false && $timeout !== "" ? (float)$timeout : 60), + 'user_agent' => $_ENV['RAPSYSPACK_AGENT'] ?? (($agent = ini_get('user_agent')) !== false && $agent !== "" ? (string)$agent : RapsysPackBundle::getAlias().'/'.RapsysPackBundle::getVersion()) ] ] );