8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/centralbank/tool.rb', line 8
def run( args )
opts = {}
parser = OptionParser.new do |cmd|
cmd.banner = "Usage: centralbank [options]"
cmd.separator ""
cmd.separator " Wallet options:"
cmd.on("-n", "--name=NAME", "Address name (default: Alice)") do |name|
opts[:address] = name
end
cmd.separator ""
cmd.separator " Server (node) options:"
cmd.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") do |host|
opts[:Host] = host end
cmd.on("-p", "--port PORT", "use PORT (default: 4567)") do |port|
opts[:Port] = port end
cmd.on("-h", "--help", "Prints this help") do
puts cmd
exit
end
end
parser.parse!( args )
pp opts
app_class = Service host = opts[:Host] || '0.0.0.0'
port = opts[:Port] || '4567'
Centralbank.configure do |config|
config.address = opts[:address] || 'Alice'
end
Rack::Handler::WEBrick.run( app_class, Host: host, Port: port ) do |server|
end
end
|