# For hosting on Heroku
require 'rack'
require 'rack/contrib/try_static'

# Serve files from the build directory
use Rack::TryStatic,
  root: 'build',
  urls: %w[/],
  try: ['.html', 'index.html', '/index.html']

run lambda { |env|
  [ 404, { 'Content-Type'  => 'text/html'}, [ "404 Not Found" ]]
}

# For hosting on Heroku
require 'rack'
require 'rack/contrib/try_static'

# "restrict" access for now
use Rack::Auth::Basic, "Restricted Area" do |username, password|
  [username, password] == [ENV['AUTH_USERNAME'], ENV['AUTH_PASSWORD']]
end

# Serve files from the build directory
use Rack::TryStatic,
  root: 'build',
  urls: %w[/],
  try: ['.html', 'index.html', '/index.html']

run lambda { |env|
  [ 404, { 'Content-Type'  => 'text/html'}, [ "404 Not Found" ]]
}

Use HTTP auth to restrict access
Use HTTP auth to restrict access

We need this because we can't use the font & crown on non-gov.uk pages.
The username/password are the default pseudo-secret
GDS-username/password combo.
