@@ -130,11 +130,14 @@ setup_production() {
130130
131131 # Update map styles. This line should be removed later, as the configuration should come from the module.
132132 SERVER_URL_=" ${SERVER_URL/ www./ } "
133+ # Tiler host. Defaults to vtiles.<server domain>; override VTILES_DOMAIN to use a
134+ # shared tiler (e.g. a preview that has no tiler of its own).
135+ VTILES_DOMAIN=" ${VTILES_DOMAIN:- vtiles.${SERVER_URL_} } "
133136 find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|openhistoricalmap.github.io|${SERVER_URL} |g" {} +
134137 find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|http://localhost:8888|https://${SERVER_URL} /map-styles|g" {} +
135138 find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|www.openhistoricalmap.org|${SERVER_URL} |g" {} +
136- find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|vtiles.openhistoricalmap.org|vtiles. ${SERVER_URL_ } |g" {} +
137- find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|vtiles.staging.openhistoricalmap.org|vtiles. ${SERVER_URL_ } |g" {} +
139+ find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|vtiles.openhistoricalmap.org|${VTILES_DOMAIN } |g" {} +
140+ find /var/www/node_modules/@openhistoricalmap/map-styles/dist/ -type f -name " *.json" -exec sed -i.bak " s|vtiles.staging.openhistoricalmap.org|${VTILES_DOMAIN } |g" {} +
138141
139142 # Replace URLs in the public directory
140143 find " /var/www/public" -type f \( \
@@ -152,8 +155,8 @@ setup_production() {
152155 -e " s|openhistoricalmap.github.io|${SERVER_URL} |g" \
153156 -e " s|http://localhost:8888|https://${SERVER_URL} /map-styles|g" \
154157 -e " s|www.openhistoricalmap.org|${SERVER_URL} |g" \
155- -e " s|vtiles.openhistoricalmap.org|vtiles. ${SERVER_URL_ } |g" \
156- -e " s|vtiles.staging.openhistoricalmap.org|vtiles. ${SERVER_URL_ } |g" \
158+ -e " s|vtiles.openhistoricalmap.org|${VTILES_DOMAIN } |g" \
159+ -e " s|vtiles.staging.openhistoricalmap.org|${VTILES_DOMAIN } |g" \
157160 " $file "
158161 done
159162
0 commit comments