From 6150d0496bba321c68717bca5f23921d062f6197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morel=20Se=CC=81bastien?= Date: Sun, 5 Aug 2018 12:12:58 -0700 Subject: [PATCH] SESSION: make it consistent --- app/config/default_parameters.yml | 12 ++++++------ app/config/env/generic.php | 4 ++++ app/config/env/platformsh.php | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/config/default_parameters.yml b/app/config/default_parameters.yml index 8b23cfbea0..164d8bf911 100644 --- a/app/config/default_parameters.yml +++ b/app/config/default_parameters.yml @@ -43,9 +43,6 @@ parameters: # using EzSystemsPlatformHttpCacheBundle (default as of v1.12) which by design expires affected cache on changes httpcache_default_ttl: '%env(HTTPCACHE_DEFAULT_TTL)%' - # Session save path as used by symfony session handlers (eg. used for dsn with redis) - ezplatform.session.save_path: '%env(SESSION_SAVE_PATH)%' - # Recommendation Bundle params ez_recommendation.default.yoochoose.customer_id: '%env(RECOMMENDATIONS_CUSTOMER_ID)%' ez_recommendation.default.yoochoose.license_key: '%env(RECOMMENDATIONS_LICENSE_KEY)%' @@ -95,9 +92,12 @@ parameters: # env: HTTPCACHE_PURGE_TYPE purge_type: local - ## Session handler, by default set to file based (instead of ~) in order to be able to use %ezplatform.session.save_path% - # env: SESSION_HANDLER_ID - ezplatform.session.handler_id: session.handler.native_file + ## Session handler, by default relying on the php.ini + # env: SESSION_HANDLER_ID (to override it) + ezplatform.session.handler_id: ~ + # Used when ezplatform.session.handler_id is not null + # env: SESSION_SAVE_PATH (to override it) + ezplatform.session.save_path: ~ # Admin siteaccess group name admin_group_name: admin_group diff --git a/app/config/env/generic.php b/app/config/env/generic.php index 72ccf2be2b..ee0a14cf30 100644 --- a/app/config/env/generic.php +++ b/app/config/env/generic.php @@ -71,3 +71,7 @@ if ($value = getenv('SESSION_HANDLER_ID')) { $container->setParameter('ezplatform.session.handler_id', $value); } + +if ($value = getenv('SESSION_SAVE_PATH')) { + $container->setParameter('ezplatform.session.save_path', $value); +} diff --git a/app/config/env/platformsh.php b/app/config/env/platformsh.php index b7c2740b9a..19de68c6c5 100644 --- a/app/config/env/platformsh.php +++ b/app/config/env/platformsh.php @@ -105,7 +105,7 @@ } $container->setParameter('ezplatform.session.handler_id', 'ezplatform.core.session.handler.native_redis'); - $container->setParameter('ezplatform.session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port'])); + $container->setParameter('ezplatform.session.save_path', sprintf('tcp://%s:%d', $endpoint['host'], $endpoint['port'])); } } elseif (isset($relationships['rediscache'])) { foreach ($relationships['rediscache'] as $endpoint) { @@ -114,6 +114,6 @@ } $container->setParameter('ezplatform.session.handler_id', 'ezplatform.core.session.handler.native_redis'); - $container->setParameter('ezplatform.session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port'])); + $container->setParameter('ezplatform.session.save_path', sprintf('tcp://%s:%d', $endpoint['host'], $endpoint['port'])); } }