Skip to content

Commit

Permalink
Add rack cors
Browse files Browse the repository at this point in the history
  • Loading branch information
adz committed Sep 15, 2015
1 parent f2083af commit 96e99cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env ruby
require "bundler/setup"

require "rack/cors"
require "quickets"

use Rack::Cors do
allow do
origins '*'
resource '/*', :headers => :any, :methods => [:get, :post, :options]
end
end

run Quickets::App.freeze.app
2 changes: 1 addition & 1 deletion lib/quickets.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Setup base yamload dir
require 'yamload'

current_file_dir = File.expand_path(File.dirname(__FILE__))
Yamload.dir = File.expand_path(File.join(current_file_dir, '..', 'config'))
puts File.expand_path(File.join(current_file_dir, '..', 'config'))

require "quickets/config"

Expand Down
4 changes: 3 additions & 1 deletion lib/quickets/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
module Quickets
class Config
def initialize
@config = Yamload::Loader.new("quickets").content
# Yamload::Loader.new("quickets").content
@config = YAML.load_file ENV['QUICKETS_CONFIG_FILE']
#"config/quickets.yml"
end

def api_key
Expand Down
1 change: 1 addition & 0 deletions quickets.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "yamload"
spec.add_dependency "roda"
spec.add_dependency "puma"
spec.add_dependency "rack-cors"

spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rake", "~> 10.0"
Expand Down

0 comments on commit 96e99cb

Please sign in to comment.