Skip to content

Simple redis url does not work #103

Description

@alexandru-calinoiu

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions