bin/redis-browser in redis-browser-0.3.0 vs bin/redis-browser in redis-browser-0.3.1

- old
+ new

@@ -1,9 +1,36 @@ #!/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" -RedisBrowser::Web.run! :port => 4569 +# 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("-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