Last active
December 28, 2017 17:02
-
-
Save nathanpalmer/0f622eb5274954885a69cbc5a1c5daaf to your computer and use it in GitHub Desktop.
Index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGER = if !ENV['TIMBER_API_KEY'].nil? | |
require 'timber' | |
Timber.config.integrations.rack.http_events.silence_request = lambda do |rack_env, rack_request| | |
# rack_request.path returns a string *without* the query string. | |
# The request of the lambda must be a boolean | |
rack_request.path == "/status" || | |
rack_request.path == "/favicon.ico" | |
end | |
Timber::Logger.new(Timber::LogDevices::HTTP.new(ENV['TIMBER_API_KEY'])) | |
else | |
require 'logger' | |
Logger.new(STDOUT) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative './logger' | |
require_relative './serve' | |
require_relative './status' | |
app = Rack::URLMap.new({ | |
'/status' => Status.new, | |
'/' => Serve.new(options) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Status | |
def call(env) | |
[ | |
'200', | |
{'Content-Type' => 'text/html'}, | |
['OK'] | |
] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment