Skip to content
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

Simple redis url does not work #103

Open
alexandru-calinoiu opened this issue Aug 4, 2020 · 2 comments
Open

Simple redis url does not work #103

alexandru-calinoiu opened this issue Aug 4, 2020 · 2 comments

Comments

@alexandru-calinoiu
Copy link

Running a js app inside a container,

In deploy.js I have the following simple config

  ENV.redis = {
    url: process.env['REDIS_URL']
  }

The url in the env is REDIS_URL=redis://redis:6379/0

Apparently it will fail to parse as it will still try to connect to localhost (the default host).

To work around it I need to do the parsing myself:

  const { URL } = require('url');
  const redisURL = new URL(process.env['REDIS_URL'])

  ENV.redis = {
    host: redisURL.hostname,
    port: redisURL.port,
    username: redisURL.username,
    password: redisURL.password
  };

It will be ideal to have the parsing done by this library.

@lukemelia
Copy link
Contributor

Thanks for the report @alexandru-calinoiu.

For you or anyone else who would like to investigate, the URL is parsed by the underlying redis client, ioredis.

We do have some code in this plugin that attempts to remove any username from the URL before passing it along. This was added to support how heroku exposes its redis URLs, IIRC. That code could be the culprit.

@alexandru-calinoiu
Copy link
Author

Got it, opened an issue with them, will leave this open and eventually advise to update the dependency on ioredis if they fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants