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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/nanite/config.rb', line 27
def setup_common_options(opts, options, type)
opts.version = Nanite::VERSION
opts.on("-i", "--irb-console", "Start #{type} in irb console mode.") do |console|
options[:console] = 'irb'
end
opts.on("-u", "--user USER", "Specify the rabbitmq username.") do |user|
options[:user] = user
end
opts.on("-h", "--host HOST", "Specify the rabbitmq hostname.") do |host|
options[:host] = host
end
opts.on("-P", "--port PORT", "Specify the rabbitmq PORT, default 5672.") do |port|
options[:port] = port
end
opts.on("-p", "--pass PASSWORD", "Specify the rabbitmq password") do |pass|
options[:pass] = pass
end
opts.on("-t", "--token IDENITY", "Specify the #{type} identity.") do |ident|
options[:identity] = ident
end
opts.on("-v", "--vhost VHOST", "Specify the rabbitmq vhost") do |vhost|
options[:vhost] = vhost
end
opts.on("-s", "--secure", "Use Security features of rabbitmq to restrict nanites to themselves") do
options[:secure] = true
end
opts.on("-f", "--format FORMAT", "The serialization type to use for transfering data. Can be marshal, json or yaml. Default is marshal") do |json|
options[:format] = :json
end
opts.on("-d", "--daemonize", "Run #{type} as a daemon") do |d|
options[:daemonize] = true
end
opts.on("-l", "--log-level LEVEL", "Specify the log level (fatal, error, warn, info, debug). Default is info") do |level|
options[:log_level] = level
end
opts.on("--version", "Show the nanite version number") do |res|
puts "Nanite Version #{opts.version}"
exit
end
end
|