-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.rb
102 lines (83 loc) · 2.74 KB
/
config.rb
1
2
3
4
5
6
7
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
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
require 'sinatra/base'
module Sinatra
module Config
def self.registered(app)
app.configure do
app.set :wsrep_state_dir, '/etc/mysql/wsrep'
app.set(:hostname) { `hostname`.chomp }
logger = ::Logger.new('log/check.log')
logger.level = ::Logger::INFO
app.set :check_logger, logger
error_logger = ::File.new(::File.join('log', 'error.log'), 'a+')
error_logger.sync = true
app.set :error_logger, error_logger
app.set :checkers, {}
app.set :max_staleness, 10
app.set :check_interval, 1
app.set :statsd_host, '127.0.0.1'
app.set :statsd_port, 8125
app.set :services, [:xdb, :zk]
end
app.configure :test do
app.set :connection_settings, {
host: 'localhost',
username: 'root',
database: 'health_check',
reconnect: true
}
app.set :zk_connection_settings, {
host: 'localhost',
port: 2181,
timeout: 5
}
app.set :zk_outstanding_threshold, 60
app.set :hostname, 'test.local'
logger = Logger.new('/dev/null')
logger.level = Logger::DEBUG
app.set :check_logger, logger
app.set :statsd_host, '0.0.0.0'
end
app.configure :development do
app.set :wsrep_state_dir, 'spec/data/3_node_cluster_synced'
app.set :connection_settings, {
host: 'localhost',
username: 'root',
database: 'health_check',
reconnect: true
}
app.set :zk_connection_settings, {
host: 'localhost',
port: 2181,
timeout: 5
}
app.set :zk_outstanding_threshold, 60
app.set :hostname, 'dev.local'
logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG
app.set :check_logger, logger
end
app.configure :production do
config = YAML.load_file ENV['WHAZZUP_CONFIG']
app.set :services, config['services'].map(&:to_sym)
app.set :check_interval, config['check_interval'].to_i if config['check_interval']
if config['connection_settings']
app.set :connection_settings, {
host: 'localhost',
username: config['connection_settings']['username'],
password: config['connection_settings']['password'],
database: 'health_check',
reconnect: true
}
end
if config['zk']
app.set :zk_connection_settings, {
host: config['zk']['host'],
port: config['zk']['port'],
timeout: config['zk']['timeout']
}
app.set :zk_outstanding_threshold, config['zk']['outstanding_threshold']
end
end
end
end
end