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
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/omf-sfa/am/am_runner.rb', line 23
def initialize(argv, opts = {})
raise "SINGLETON" if @@instance
@argv = argv
sopts = opts.delete(:ssl)
@options = {
:chdir => Dir.pwd,
:environment => 'development',
:address => '0.0.0.0',
:port => Thin::Server::DEFAULT_PORT,
:timeout => Thin::Server::DEFAULT_TIMEOUT,
:log => 'log/thin.log',
:pid => 'tmp/pids/thin.pid',
:max_conns => Thin::Server::DEFAULT_MAXIMUM_CONNECTIONS,
:max_persistent_conns => Thin::Server::DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS,
:require => [],
:wait => Thin::Controllers::Cluster::DEFAULT_WAIT_TIME
}.merge(opts)
print_options = false
p = parser
p.separator ""
p.separator "Datamapper options:"
p.on("--dm-db URL", "Datamapper database [#{@options[:dm_db]}]") do |u| @options[:dm_db] = u end
p.on("--dm-log FILE", "Datamapper log file [#{@options[:dm_log]}]") do |n| @options[:dm_log] = n end
p.on("--dm-auto-upgrade", "Run Datamapper's auto upgrade") do |n| @options[:dm_auto_upgrade] = true end
p.separator ""
p.separator "Testing options:"
p.on("--test-load-am", "Load an AM configuration for testing") do |n| @options[:load_test_am] = true end
p.on("--disable-https", "Run server without SSL") do sopts = nil end
p.on("--print-options", "Print option settings after parsing command lines args") do print_options = true end
p.separator ""
p.separator "Common options:"
parse!
if sopts
@options[:ssl] = true
@options[:ssl_key_file] ||= sopts[:key_file]
@options[:ssl_cert_file] ||= sopts[:cert_file]
@options[:ssl_verify] ||= sopts[:verify_peer]
end
if print_options
require 'pp'
pp @options
end
@@instance = self
end
|