diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-03-29 22:22:11 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-03-29 22:28:36 -0700 |
commit | ae47e5afc5674c13bdbff3afc887a1505f15bd4f (patch) | |
tree | a7e108b0a044785c1868cfdd2c73480a54e9de47 /bin/unicorn | |
parent | 45dc7c2acae82c4699c2678017ae714f032aa8b1 (diff) | |
download | unicorn-ae47e5afc5674c13bdbff3afc887a1505f15bd4f.tar.gz |
Combining command-line and config file options in a reasonable manner has and always will be a painful experience.
Diffstat (limited to 'bin/unicorn')
-rwxr-xr-x | bin/unicorn | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/unicorn b/bin/unicorn index 9deb872..da77198 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -6,8 +6,8 @@ env = "development" daemonize = false listeners = [] options = { :listeners => listeners } -host = Unicorn::Const::DEFAULT_HOST -port = Unicorn::Const::DEFAULT_PORT +host, port = Unicorn::Const::DEFAULT_HOST, Unicorn::Const::DEFAULT_PORT +set_listener = false opts = OptionParser.new("", 24, ' ') do |opts| opts.banner = "Usage: #{File.basename($0)} " \ @@ -46,11 +46,13 @@ opts = OptionParser.new("", 24, ' ') do |opts| opts.on("-o", "--host HOST", "listen on HOST (default: #{Unicorn::Const::DEFAULT_HOST})") do |h| host = h + set_listener = true end opts.on("-p", "--port PORT", "use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p| port = p.to_i + set_listener = true end opts.on("-E", "--env ENVIRONMENT", @@ -148,10 +150,7 @@ else inner_app end -if listeners.empty? - listener = "#{host}:#{port}" - listeners << listener -end +listeners << "#{host}:#{port}" if set_listener if $DEBUG pp({ |