Skip to content

Commit

Permalink
limit available scopes to hopefully serve rails and other routes prop…
Browse files Browse the repository at this point in the history
…erly
  • Loading branch information
mortbauer committed Feb 19, 2024
1 parent e7abc00 commit 798a862
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ RUN mkdir -p tmp storage && \
chown nobody storage

COPY docker-entrypoint.sh ./

RUN apt-get install -y gosu
# Run app as unprivileged user
USER nobody
# USER nobody

EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

scope '/:foodcoop' do
scope '/:foodcoop', foodcoop: /__FOODCOOPS__/ do
use_doorkeeper

# Root path
Expand Down
6 changes: 5 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ if [ ! -z "${FOODSOFT_DB_PREFIX}" ] || [ ! -z "${FOODSOFT_DB_PREFIX_FILE}" ]; th
FOODSOFT_FOODCOOPS=`BUNDLE_CONFIG=/dev/null bundle exec ruby script/list_databases`
fi

FOODSOFT_FOODCOOPS_REGEX=`echo $FOODSOFT_FOODCOOPS | sed 's/ /|/g'`

sed -i "s/__FOODCOOPS__/$FOODSOFT_FOODCOOPS_REGEX/g" config/routes.rb

if [ -e app_config.defaults.yml ] ; then
cat app_config.defaults.yml > config/app_config.yml

Expand All @@ -23,4 +27,4 @@ EOF
done
fi

exec "$@"
exec gosu nobody:nogroup "$@"

0 comments on commit 798a862

Please sign in to comment.