Created
April 22, 2014 20:43
-
-
Save mikehale/11193614 to your computer and use it in GitHub Desktop.
Workaround for sinatra-assetpack with SSL
This file contains 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
require 'sinatra' | |
require 'rack-test-ext' | |
configure :production do | |
use Rack::SSL | |
Rack::Test::Session.custom_env['HTTPS'] = 'on' | |
end | |
assets do | |
css :application, [ '/css/app.css' ] | |
prebuild true | |
end |
This file contains 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
class Rack::Test::Session | |
def self.custom_env | |
@custom_env ||= {} | |
end | |
def default_env_with_custom_env | |
default_env_without_custom_env.merge(self.class.custom_env) | |
end | |
alias_method :default_env_without_custom_env, :default_env | |
alias_method :default_env, :default_env_with_custom_env | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment