Skip to content

Commit

Permalink
Merge pull request #11400 from camptocamp/no-evalute
Browse files Browse the repository at this point in the history
Be able to disable some evaluate
  • Loading branch information
sbrunner authored Oct 2, 2024
2 parents 6ca19be + 210c96f commit 2dd7eac
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \

COPY scripts/extract-messages.js /opt/c2cgeoportal/geoportal/

ENV TEST=false
ENV PATH=/opt/c2cgeoportal/geoportal/node_modules/.bin:$PATH
ENV NODE_PATH=/opt/c2cgeoportal/geoportal/node_modules

Expand Down
42 changes: 31 additions & 11 deletions bin/eval-templates
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,43 @@ function evaluate {
fi
}

if [ "${TEST}" == true ]; then
if [ "${TEST:-false}" == true ]; then
find /opt/c2cgeoportal/ -name '*.tmpl' -print | while read -r file; do
evaluate "$file"
done
fi

find /app/ -name '*.tmpl' -print | while read -r file; do
evaluate "$file"
done
if [ "${EVALUATE_APP:-true}" == true ]; then
find /app/ -name '*.tmpl' -print | while read -r file; do
evaluate "$file"
done
fi

find /etc/static-ngeo/ -name '*.tmpl' -print | while read -r file; do
evaluate "$file"
done
if [ "${EVALUATE_NGEO_TMPL:-true}" == true ]; then
find /etc/static-ngeo/ -name '*.tmpl' -print | while read -r file; do
evaluate "$file"
done
fi

find /etc/static-ngeo/ \( -name '*.js' -or -name '*.css' -or -name '*.html' \) -print | while read -r file; do
echo "Evaluate: ${file}"
sed --in-place --expression="s#\.__ENTRY_POINT__#${VISIBLE_ENTRY_POINT}#g" "${file}"
done
if [ "${EVALUATE_NGEO_JS:-true}" == true ]; then
find /etc/static-ngeo/ -name '*.js' -print | while read -r file; do
echo "Evaluate: ${file}"
sed --in-place --expression="s#\.__ENTRY_POINT__#${VISIBLE_ENTRY_POINT}#g" "${file}"
done
fi

if [ "${EVALUATE_NGEO_CSS:-true}" == true ]; then
find /etc/static-ngeo/ -name '*.css' -print | while read -r file; do
echo "Evaluate: ${file}"
sed --in-place --expression="s#\.__ENTRY_POINT__#${VISIBLE_ENTRY_POINT}#g" "${file}"
done
fi

if [ "${EVALUATE_NGEO_HTML:-true}" == true ]; then
find /etc/static-ngeo/ -name '*.html' -print | while read -r file; do
echo "Evaluate: ${file}"
sed --in-place --expression="s#\.__ENTRY_POINT__#${VISIBLE_ENTRY_POINT}#g" "${file}"
done
fi

exec "$@"
5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ services:
- PGSSLMODE=disable
- CI=true
- TEST=true
- EVALUATE_APP=false
- EVALUATE_NGEO_TMPL=false
- EVALUATE_NGEO_JS=false
- EVALUATE_NGEO_CSS=false
- EVALUATE_NGEO_HTML=false
entrypoint:
- /usr/bin/eval-templates
command:
Expand Down

0 comments on commit 2dd7eac

Please sign in to comment.