Skip to content

Instantly share code, notes, and snippets.

@nathanpalmer
Last active December 28, 2017 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanpalmer/0f622eb5274954885a69cbc5a1c5daaf to your computer and use it in GitHub Desktop.
Save nathanpalmer/0f622eb5274954885a69cbc5a1c5daaf to your computer and use it in GitHub Desktop.
Index
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
require_relative './logger'
require_relative './serve'
require_relative './status'
app = Rack::URLMap.new({
'/status' => Status.new,
'/' => Serve.new(options)
})
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