Allow redis credentials be URL-decoded before passing them to connection

This commit is contained in:
Alejandro Celaya 2023-11-23 11:22:23 +01:00
parent 0511c73cc8
commit df57ca5edb
6 changed files with 9 additions and 4 deletions

View File

@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
This is important if you are running multiple Shlink instance on the same server, or they share the same Redis instance (even more so if they are on different versions). This is important if you are running multiple Shlink instance on the same server, or they share the same Redis instance (even more so if they are on different versions).
* [#1905](https://github.com/shlinkio/shlink/issues/1905) Add support for PHP 8.3. * [#1905](https://github.com/shlinkio/shlink/issues/1905) Add support for PHP 8.3.
* [#1927](https://github.com/shlinkio/shlink/issues/1927) Allow redis credentials be URL-decoded before passing them to connection.
### Changed ### Changed
* [#1799](https://github.com/shlinkio/shlink/issues/1799) RoadRunner/openswoole jobs are not run anymore for tasks that are actually disabled. * [#1799](https://github.com/shlinkio/shlink/issues/1799) RoadRunner/openswoole jobs are not run anymore for tasks that are actually disabled.

View File

@ -41,16 +41,16 @@
"mezzio/mezzio-problem-details": "^1.13", "mezzio/mezzio-problem-details": "^1.13",
"mezzio/mezzio-swoole": "^4.7", "mezzio/mezzio-swoole": "^4.7",
"mlocati/ip-lib": "^1.18", "mlocati/ip-lib": "^1.18",
"mobiledetect/mobiledetectlib": "^3.74", "mobiledetect/mobiledetectlib": "^4.8",
"pagerfanta/core": "^3.8", "pagerfanta/core": "^3.8",
"php-middleware/request-id": "^4.1", "php-middleware/request-id": "^4.1",
"pugx/shortid-php": "^1.1", "pugx/shortid-php": "^1.1",
"ramsey/uuid": "^4.7", "ramsey/uuid": "^4.7",
"shlinkio/shlink-common": "dev-main#7d46772 as 5.7", "shlinkio/shlink-common": "dev-main#e24ea7b as 5.7",
"shlinkio/shlink-config": "dev-main#cde5d3b as 2.5", "shlinkio/shlink-config": "dev-main#cde5d3b as 2.5",
"shlinkio/shlink-event-dispatcher": "dev-main#35ccc0b as 3.1", "shlinkio/shlink-event-dispatcher": "dev-main#35ccc0b as 3.1",
"shlinkio/shlink-importer": "dev-main#d621b20 as 5.2", "shlinkio/shlink-importer": "dev-main#d621b20 as 5.2",
"shlinkio/shlink-installer": "dev-develop#c505a19 as 8.6", "shlinkio/shlink-installer": "dev-develop#0fde6fd as 8.6",
"shlinkio/shlink-ip-geolocation": "dev-main#4a1cef8 as 3.3", "shlinkio/shlink-ip-geolocation": "dev-main#4a1cef8 as 3.3",
"shlinkio/shlink-json": "dev-main#e5a111c as 1.1", "shlinkio/shlink-json": "dev-main#e5a111c as 1.1",
"spiral/roadrunner": "^2023.2", "spiral/roadrunner": "^2023.2",

View File

@ -11,6 +11,7 @@ return (static function (): array {
'redis' => [ 'redis' => [
'servers' => $redisServers, 'servers' => $redisServers,
'sentinel_service' => EnvVars::REDIS_SENTINEL_SERVICE->loadFromEnv(), 'sentinel_service' => EnvVars::REDIS_SENTINEL_SERVICE->loadFromEnv(),
'decode_credentials' => (bool) EnvVars::REDIS_DECODE_CREDENTIALS->loadFromEnv(false),
], ],
]; ];

View File

@ -32,6 +32,7 @@ return [
Option\Worker\TaskWorkerNumConfigOption::class, Option\Worker\TaskWorkerNumConfigOption::class,
Option\Worker\WebWorkerNumConfigOption::class, Option\Worker\WebWorkerNumConfigOption::class,
Option\Redis\RedisServersConfigOption::class, Option\Redis\RedisServersConfigOption::class,
Option\Redis\RedisDecodeCredentialsConfigOption::class,
Option\Redis\RedisSentinelServiceConfigOption::class, Option\Redis\RedisSentinelServiceConfigOption::class,
Option\Redis\RedisPubSubConfigOption::class, Option\Redis\RedisPubSubConfigOption::class,
Option\UrlShortener\ShortCodeLengthOption::class, Option\UrlShortener\ShortCodeLengthOption::class,

View File

@ -20,6 +20,7 @@ enum EnvVars: string
case CACHE_NAMESPACE = 'CACHE_NAMESPACE'; case CACHE_NAMESPACE = 'CACHE_NAMESPACE';
case REDIS_SERVERS = 'REDIS_SERVERS'; case REDIS_SERVERS = 'REDIS_SERVERS';
case REDIS_SENTINEL_SERVICE = 'REDIS_SENTINEL_SERVICE'; case REDIS_SENTINEL_SERVICE = 'REDIS_SENTINEL_SERVICE';
case REDIS_DECODE_CREDENTIALS = 'REDIS_DECODE_CREDENTIALS';
case REDIS_PUB_SUB_ENABLED = 'REDIS_PUB_SUB_ENABLED'; case REDIS_PUB_SUB_ENABLED = 'REDIS_PUB_SUB_ENABLED';
case MERCURE_PUBLIC_HUB_URL = 'MERCURE_PUBLIC_HUB_URL'; case MERCURE_PUBLIC_HUB_URL = 'MERCURE_PUBLIC_HUB_URL';
case MERCURE_INTERNAL_HUB_URL = 'MERCURE_INTERNAL_HUB_URL'; case MERCURE_INTERNAL_HUB_URL = 'MERCURE_INTERNAL_HUB_URL';

View File

@ -12,7 +12,8 @@ enum DeviceType: string
public static function matchFromUserAgent(string $userAgent): ?self public static function matchFromUserAgent(string $userAgent): ?self
{ {
$detect = new MobileDetect(userAgent: $userAgent); $detect = new MobileDetect();
$detect->setUserAgent($userAgent);
return match (true) { return match (true) {
// $detect->is('iOS') && $detect->isTablet() => self::IOS, // TODO To detect iPad only // $detect->is('iOS') && $detect->isTablet() => self::IOS, // TODO To detect iPad only