50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/jubilee/cli.rb', line 50
def setup_options
@options = {
debug: false,
daemon: false,
ssl: false,
Port: 8080,
environment: ENV["RACK_ENV"] || "development"
}
@parser = OptionParser.new do |o|
o.separator ""
o.separator "Server options:"
o.on "-c", "--config PATH", "Load PATH as a config file" do |arg|
@options[:config_file] = arg
end
o.on "-d", "--daemon", "Daemonize the server" do
@options[:daemon] = true
end
o.on "--dir DIR", "Change to DIR before starting" do |arg|
@options[:working_directory] = arg
end
o.on "-p", "--port PORT", "Defind which PORT the server should bind" do |arg|
@options[:Port] = arg.to_i
end
o.on "-b", "--host HOST", "Defind which HOST the server should bind, default 0.0.0.0" do |arg|
@options[:Host] = arg
end
o.on "-e", "--environment ENV", "Rack environment" do |arg|
@options[:environment] = arg
end
o.separator ""
o.separator "SSL options:"
o.on "--ssl", "Enable SSL connection" do
@options[:ssl] = true
end
o.on "--ssl-keystore PATH", "SSL keystore path" do |arg|
@options[:ssl_keystore] = arg
end
o.on "--ssl-password PASS", "SSL keystore password" do |arg|
@options[:ssl_keystore] = arg
end
o.separator ""
o.separator "Event bus options:"
o.on "--eventbus PREFIX", "Event bus prefix, use allow-all policy by default" do |arg|
@options[:eventbus_prefix] = arg
end
o.separator ""
o.separator "Clustering options:"
o.on "--cluster", "Enable clustering" do
@options[:cluster_host] = "0.0.0.0"
end
o.on "--cluster-port PORT", "If the cluster option has also been specified then this determines which port will be used for cluster communication with other Vert.x instances. Default is 0 -which means 'chose a free ephemeral port. You don't usually need to specify this parameter unless you really need to bind to a specific port." do |port|
@options[:cluster_port] = port.to_i
end
o.on "--cluster-host HOST", "If the cluster option has also been specified then this determines which host address will be used for cluster communication with other Vert.x instances. By default it will try and pick one from the available interfaces. If you have more than one interface and you want to use a specific one, specify it here." do |host|
@options[:cluster_host] = host
end
o.separator ""
o.separator "Common options:"
o.on "--verbose", "Log low level debug information" do
@options[:debug] = true
end
o.on "-q", "--quiet", "Disable logging" do
@options[:quiet] = true
end
end
@parser.banner = "jubilee <options> <rackup file>"
@parser.on_tail "-h", "--help", "Show this message" do
puts @parser
exit 1
end
end
|