Skip to content

Commit c7cf542

Browse files
committed
map legacy options to the "sentinel" key when parsing DSNs
1 parent 27ef10f commit c7cf542

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,21 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
260260
}, $paramss, $dsns);
261261
}
262262

263+
if (isset($options['sentinel']) && isset($options['redis_sentinel']) && $options['sentinel'] !== $options['redis_sentinel']) {
264+
throw new InvalidArgumentException('Cannot use both "sentinel" and "redis_sentinel" at the same time.');
265+
}
266+
267+
if (isset($options['sentinel']) && isset($options['sentinel_master']) && $options['sentinel'] !== $options['sentinel_master']) {
268+
throw new InvalidArgumentException('Cannot use both "sentinel" and "sentinel_master" at the same time.');
269+
}
270+
271+
if (isset($options['redis_sentinel']) && isset($options['sentinel_master']) && $options['redis_sentinel'] !== $options['sentinel_master']) {
272+
throw new InvalidArgumentException('Cannot use both "redis_sentinel" and "sentinel_master" at the same time.');
273+
}
274+
275+
$options['sentinel'] ??= $options['redis_sentinel'] ?? $options['sentinel_master'] ?? null;
276+
unset($options['redis_sentinel'], $options['sentinel_master']);
277+
263278
if ($invalidOptions = array_diff(array_keys($options), array_keys(self::DEFAULT_OPTIONS), ['host', 'port'])) {
264279
throw new LogicException(\sprintf('Invalid option(s) "%s" passed to the Redis Messenger transport.', implode('", "', $invalidOptions)));
265280
}

0 commit comments

Comments
 (0)