Skip to content

Commit

Permalink
apply scope constraints to all plugins as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbauer committed Feb 19, 2024
1 parent 6385ab3 commit 84ccd79
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

root to: 'sessions#redirect_to_foodcoop', as: nil

scope '/:foodcoop', foodcoop: /__FOODCOOPS__/ do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
use_doorkeeper

# Root path
Expand Down
6 changes: 6 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ fi
FOODSOFT_FOODCOOPS_REGEX=`echo $FOODSOFT_FOODCOOPS | sed 's/ /|/g'`

sed -i "s/__FOODCOOPS__/$FOODSOFT_FOODCOOPS_REGEX/g" config/routes.rb
for plugin in $(ls plugins); do
if [ -f "plugins/$plugin/config/routes.rb" ]; then
sed -i "s/__FOODCOOPS__/$FOODSOFT_FOODCOOPS_REGEX/g" plugins/$plugin/config/routes.rb
fi
done


if [ -e app_config.defaults.yml ] ; then
cat app_config.defaults.yml > config/app_config.yml
Expand Down
2 changes: 1 addition & 1 deletion plugins/current_orders/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
namespace :current_orders do
resources :ordergroups, only: %i[index show] do
collection do
Expand Down
2 changes: 1 addition & 1 deletion plugins/discourse/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
get '/discourse/callback' => 'discourse_login#callback'
get '/discourse/initiate' => 'discourse_login#initiate'
get '/discourse/sso' => 'discourse_sso#sso'
Expand Down
2 changes: 1 addition & 1 deletion plugins/documents/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
resources :documents do
get :move
get :new
Expand Down
2 changes: 1 addition & 1 deletion plugins/links/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
resources :links, only: [:show]

namespace :admin do
Expand Down
2 changes: 1 addition & 1 deletion plugins/messages/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
resources :messages, only: %i[index show new create] do
member do
get :thread
Expand Down
2 changes: 1 addition & 1 deletion plugins/polls/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
resources :polls do
member do
get :vote
Expand Down
2 changes: 1 addition & 1 deletion plugins/printer/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
namespace :api do
namespace :v1 do
resources :printer, only: [:show]
Expand Down
2 changes: 1 addition & 1 deletion plugins/wiki/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
scope '/:foodcoop' do
scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do
resources :pages do
get :all, on: :collection
get :version, on: :member
Expand Down

0 comments on commit 84ccd79

Please sign in to comment.