From 884434e58dda34f2c3f780999c74f8d6a11569d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Mon, 4 Mar 2024 17:18:47 +0100 Subject: [PATCH 1/1] Use RAPSYSPACK_AGENT, RAPSYSPACK_REDIRECT and RAPSYSPACK_TIMEOUT env variables --- Controller/MapController.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Controller/MapController.php b/Controller/MapController.php index 193d336..869d5ab 100644 --- a/Controller/MapController.php +++ b/Controller/MapController.php @@ -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'] ?? (int)ini_get('default_socket_timeout') ?: 60, + 'user_agent' => $_ENV['RAPSYSPACK_AGENT'] ?? (($agent = ini_get('user_agent')) !== false && $agent !== "" ? (string)$agent : RapsysPackBundle::getAlias().'/'.RapsysPackBundle::getVersion()) ] ] ); -- 2.41.1