Sha256: b04ae0046733a5f108ac645a6054b9be3677f8347e2eb5659f9d88aba27cdb86
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 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 sinatra_options = { bind: '127.0.0.1', port: 4567 } redis_connection = {} 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("-h HOSTNAME", "Default redis connection hostname") do |v| redis_connection['host'] = v end opts.on("-p PORT", "Default redis connection port") do |v| redis_connection['port'] = v end opts.on("-n DB", "Default redis connection database number") do |v| redis_connection['db'] = v end opts.on("-a PASSWORD", "Default redis connection password") do |v| redis_connection['auth'] = v end opts.on("-B ADDRESS", "--bind ADDRESS", "Server hostname or IP address to listen on") do |v| sinatra_options['bind'] = v end opts.on("-P PORT", "--port PORT", "Port number to listen on") do |v| sinatra_options['port'] = v end opts.on("-v", "--version", "Display version number") do puts RedisBrowser::VERSION exit end end.parse! unless redis_connection.empty? config = { 'connections' => { 'default' => redis_connection } } RedisBrowser.configure(config) end RedisBrowser::Web.run! sinatra_options
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis-browser-0.5.1 | bin/redis-browser |