redisTarget method

({String host, RedisOptions options, int port}) redisTarget()

Where Redis is: --redis-url, else the REDIS_URL environment variable (keeps a password out of the process list), else --redis-host / --redis-port.

Implementation

({String host, int port, RedisOptions options}) redisTarget() {
  final url = string('redis-url') ?? Platform.environment['REDIS_URL'];
  if (url != null && url.isNotEmpty) return RedisOptions.parseUrl(url);
  return (
    host: stringOr('redis-host', 'localhost'),
    port: intOr('redis-port', 6379),
    options: const RedisOptions(),
  );
}