Skip to content

The REDIS_URL environment variable does not support passwords. #3036

Description

@orion-gmx

Background: For security reasons, I intended to use a password-protected Redis, but it seems that REDIS_URL in the api.hcl environment does not support it and reports an error.

Error log: redis://xxxx:xxxx@redis-xxxxxx.redis.xxxx.com:6379: too many colons in address

Root cause: The value of REDIS_URL includes the redis:// scheme prefix, but the code parses the entire string as a host:port format, leading to the “too many colons” error.

Issue confirmation: The code does not support the redis:// URI format. redis.Options.Addr only accepts host:port, and the password needs to be provided separately via the Password field; however, the current RedisConfig structure does not have a Password field.

Proposed solution: Modify the code to support parsing the URI format. In redis.go, within the branch case config.RedisURL != "", use redis.ParseURL() to parse the full URI.

Test results and conclusion: It successfully parses the password and allows Redis to function normally, while remaining compatible with the previous format. I have modified and tested the code. May I contribute it to the community?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions