[Git][noosfero/noosfero][master] 2 commits: avoid to load api mount point on rake db:schema:load

Leandro Nunes gitlab at mg.gitlab.com
Wed Jun 6 16:47:14 BRT 2018


Leandro Nunes pushed to branch master at Noosfero / noosfero


Commits:
22b8d3e1 by Leandro Nunes dos Santos at 2018-06-06T11:57:05Z
avoid to load api mount point on rake db:schema:load

- - - - -
fe499ad8 by Leandro Nunes at 2018-06-06T19:47:11Z
Merge branch 'avoid-load-api-on-rake' into 'master'

avoid to load api mount point on rake db:schema:load

See merge request noosfero/noosfero!1514
- - - - -


2 changed files:

- config.ru
- config/routes/01_api.rb


Changes:

=====================================
config.ru
=====================================
--- a/config.ru
+++ b/config.ru
@@ -1,25 +1,4 @@
 # This file is used by Rack-based servers to start the application.
 
-require_relative 'config/environment'
+run Rails.application
 
-use Rack::Cors do
-  allow do
-    origins '*'
-    resource '/api/*', :headers => :any, :methods => [:get, :post]
-  end
-end
-
-rails_app = Rack::Builder.new do
-  if ENV['RAILS_RELATIVE_URL_ROOT']
-    map ENV['RAILS_RELATIVE_URL_ROOT'] do
-      run Noosfero::Application
-    end
-  else
-    run Noosfero::Application
-  end
-end
-
-run Rack::Cascade.new([
-  rails_app,
-  Api::App
-])


=====================================
config/routes/01_api.rb
=====================================
--- a/config/routes/01_api.rb
+++ b/config/routes/01_api.rb
@@ -1,5 +1,6 @@
 Noosfero::Application.routes.draw do
 
-  mount Api::App => '/api'
-
+  unless ( File.basename($0) == "rake" && ARGV.include?("db:schema:load") )
+    mount Api::App => '/api'
+  end
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/29e8fd9f7af55c51deb75aafc592f808d074d01e...fe499ad86e558f5b6c940b96113492b85c3ca422

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/29e8fd9f7af55c51deb75aafc592f808d074d01e...fe499ad86e558f5b6c940b96113492b85c3ca422
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180606/daab1978/attachment-0001.html>


More information about the Noosfero-dev mailing list