Skip to content

Commit

Permalink
Add support for unprotected unix socket
Browse files Browse the repository at this point in the history
 - You can now provide a unix socket based redis connection: 
   - `Resque::setBackend('unix:///path/to/redis.sock')`
 - username/password/db in unix socket dsn currently unsupported: 
   - This middle layer for Dsn parsing seemed too clunky for me to introduce user/pass/db parsing for unix sockets.
  • Loading branch information
lauripiisang committed Aug 15, 2016
1 parent 6273fdd commit 4b85638
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Resque/Redis.php
Expand Up @@ -148,6 +148,7 @@ public function __construct($server, $database = null)
* - host:port
* - redis://user:pass@host:port/db?option1=val1&option2=val2
* - tcp://user:pass@host:port/db?option1=val1&option2=val2
* - unix:///path/to/redis.sock
*
* Note: the 'user' part of the DSN is not used.
*
Expand All @@ -161,6 +162,16 @@ public static function parseDsn($dsn)
// Use a sensible default for an empty DNS string
$dsn = 'redis://' . self::DEFAULT_HOST;
}
if(substr($dsn, 0, 7) === 'unix://') {
return array(
$dsn,
null,
null,
null,
null,
null,
);
}
$parts = parse_url($dsn);

// Check the URI scheme
Expand Down

0 comments on commit 4b85638

Please sign in to comment.