riemann-dash/lib/riemann/dash/rack/static.rb
Kyle Kingsbury 63489979e0 Save and reload dashboards.
Modules for persistence, global dashboard control, managing workspaces,
and keybindings. Server can save/load dashboards, merging workspaces if
necessary. Config is stored as json in a file: ./ws/config.json, for now.
2012-10-05 13:57:52 -07:00

16 lines
324 B
Ruby

class Riemann::Dash::Static
def initialize(app, options = {})
@app = app
@root = options[:root] or raise ArgumentError, "no root"
@file_server = ::Rack::File.new(@root)
end
def call(env)
r = @app.call env
if r[0] < 200 or 400 <= r[0]
@file_server.call env
else
r
end
end
end