summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/opentox.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index ebd2338..be248b6 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -28,13 +28,15 @@ module OpenTox
end
# add CORS support for swagger
- use Rack::Cors do |config|
- config.allow do |allow|
- allow.origins '*'
- allow.resource "/#{SERVICE}/*",
- :methods => [:head, :get, :post, :put, :options],
- :headers => :any,
- :max_age => 0
+ if eval("$#{SERVICE}[:cors]") == true
+ use Rack::Cors do |config|
+ config.allow do |allow|
+ allow.origins '*'
+ allow.resource "/#{SERVICE}/",
+ :methods => [:head, :get, :post, :put, :delete, :options],
+ :headers => :any,
+ :max_age => 0
+ end
end
end