Sha256: 6508d5646993e9b941284cd1c50fd7d31f9b85f1549a049bae1ce6fbb6ceb60d

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.expand_path('../../lib', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)

require 'rubygems' unless Object.const_defined?(:Gem)
require 'optparse'

require "redis-browser"

# Sinatra runtime options
options = {
  bind: '127.0.0.1',
  port: 4567
}

OptionParser.new do |opts|
  opts.banner = "Usage: redis-browser [options]"

  opts.on("-C PATH", "--config PATH", "Path to YAML config file") do |v|
    require 'yaml'
    require 'erb'

    config = YAML.load(ERB.new(IO.read(v)).result)
    RedisBrowser.configure(config)
  end

  opts.on("-U URL", "--url URL", "Connection URL. Defaults to redis://127.0.0.1:6379/0") do |v|
    v = "redis://#{v}" unless v =~ /^redis:\/\//
    config = { 'connections' => { 'default' => v } }
    RedisBrowser.configure(config)
  end

  opts.on("-B ADDRESS", "--bind ADDRESS", "Server hostname or IP address to listen on") do |v|
    options['bind'] = v
  end

  opts.on("-P PORT", "--port PORT", "Port number to listen on") do |v|
    options['port'] = v
  end
end.parse!

RedisBrowser::Web.run! options

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis-browser-0.5.0 bin/redis-browser
redis-browser-0.4.0 bin/redis-browser
redis-browser-0.3.3 bin/redis-browser