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
|
# File 'lib/getaround_utils/engines/health.rb', line 30
def self.engine
Rack::Builder.new do
map RELEASE_VERSION_PATH do
use Rack::Head
run(lambda do |env|
req = Rack::Request.new(env)
return [405, { 'Content-Type' => 'text/plain' }, []] unless req.get?
content = GetaroundUtils::Engines::Health.release_version || UNDEFINED
[200, { 'Content-Type' => 'text/plain' }, [content]]
end)
end
map COMMIT_SHA1_PATH do
use Rack::Head
run(lambda do |env|
req = Rack::Request.new(env)
return [405, { 'Content-Type' => 'text/plain' }, []] unless req.get?
content = GetaroundUtils::Engines::Health.commit_sha1 || UNDEFINED
[200, { 'Content-Type' => 'text/plain' }, [content]]
end)
end
map MIGRATION_STATUS_PATH do
use Rack::Head
run(lambda do |env|
req = Rack::Request.new(env)
return [405, { 'Content-Type' => 'application/json' }, []] unless req.get?
content = { needs_migration: GetaroundUtils::Engines::Health.needs_migration? }
[200, { 'Content-Type' => 'application/json' }, [JSON.generate(content)]]
end)
end
end
end
|