Created
January 29, 2015 00:29
-
-
Save IdahoEv/35a0264f2ab1ba9e572d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| module LrdCms2 | |
| class StaticLogger < ::Logger | |
| # needed to use stdlib logger with Rack < 1.6.0 | |
| def write(msg) | |
| self.<<(msg) | |
| end | |
| end | |
| class StaticApp | |
| def self.build(root_path, backend_port) | |
| backend_url = "http://localhost:#{backend_port}/" | |
| env = ENV['RAILS_ENV'] || 'development' | |
| logger = StaticLogger.new(Rails.root.join("log/#{env}_static.log")) | |
| Rack::Builder.new do | |
| use BackendUrlCookie, backend_url | |
| use GotoParam | |
| use Rack::CommonLogger, logger | |
| use Rack::Static, { | |
| :urls => [""], | |
| :root => root_path, | |
| :index => "index.html", | |
| :header_rules => { | |
| :all => {"Cache-Control" => "no-cache, max-age=0" } #no caching development assets | |
| } | |
| } | |
| run proc{} | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment