open-vault/website/config.ru

33 lines
1,023 B
Plaintext
Raw Normal View History

2015-03-13 17:34:29 +00:00
require "rack"
require "rack/contrib/not_found"
require "rack/contrib/response_headers"
require "rack/contrib/static_cache"
require "rack/contrib/try_static"
2015-04-10 00:19:42 +00:00
# TODO: Remove for launch
use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ["vault", "urUdt7U2aiepNKeTbCzJCd"]
end
2015-03-13 17:34:29 +00:00
# Properly compress the output if the client can handle it.
use Rack::Deflater
# Set the "forever expire" cache headers for these static assets. Since
# we hash the contents of the assets to determine filenames, this is safe
# to do.
use Rack::StaticCache,
:root => "build",
:urls => ["/images", "/javascripts", "/stylesheets"],
:duration => 2,
:versioning => false
# Try to find a static file that matches our request, since Middleman
# statically generates everything.
use Rack::TryStatic,
:root => "build",
:urls => ["/"],
:try => [".html", "index.html", "/index.html"]
# 404 if we reached this point. Sad times.
run Rack::NotFound.new(File.expand_path("../build/404.html", __FILE__))