Documentation
¶
Overview ¶
Package redisutil centralizes Redis address parsing for every parsec surface that takes an address as a string: the library's Options.RedisAddr, the `parsec keys` subcommands, and parsec-keys-sync.
It exists because go-redis' Options.Addr is a bare host:port while the broker (centrifuge.RedisShardConfig.Address) accepts full URLs. Parsec documents the URL forms, so every string-to-client conversion has to parse them the same way — previously each caller stripped the scheme by hand, which quietly discarded credentials, the database number, and (for rediss://) TLS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientOptions ¶
ClientOptions converts addr plus auth into go-redis options.
Accepted address forms:
host:port redis://[[user][:password]@]host:port[/db][?opt=val] rediss://... (same, TLS) tcp://... (alias for redis://) unix://[[user][:password]@]/path/to/socket[?db=n]
Sentinel and cluster URLs are rejected with a message pointing at Options.RedisClient, which takes a fully-configured client.
Types ¶
type Auth ¶
type Auth struct {
Username string
Password string
// DB selects the logical database. Nil means "not set", so a
// deliberate 0 still overrides a URL-supplied database.
DB *int
// TLS, when non-nil, forces a TLS connection with this config. Use it
// for private CAs; rediss:// addresses get a default config without it.
TLS *tls.Config
}
Auth carries the credential and transport overrides an operator can supply alongside the address. Every field is optional; a set field wins over whatever the address encoded, so a password in the config file overrides one embedded in the URL.