Skip to content

[redis] Authentication support added #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/redis/PhpRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ public function connect()
);
}

if (array_key_exists('pass', $this->config)) {
$this->config['auth'] = $this->config['pass'];
}

if (array_key_exists('auth', $this->config)) {
$this->redis->auth($this->config['auth']);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need the first if if (array_key_exists('pass', $this->config)) {.

<?php
            if (array_key_exists('pass', $this->config)) {
                $this->redis->auth($this->config['pass']);
            }

Copy link
Contributor Author

@FrankGiesecke FrankGiesecke Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for services like Heroku.
They provide a token for authentication in the password part.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code I posted does exactly the same but with one if statement.

$this->redis->select($this->config['database']);
}

Expand Down