File tree Expand file tree Collapse file tree
proxy/src/main/kotlin/no/entur/geocoder/proxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ INSIGHTS=(
2121fetch () {
2222 local short_id=$1
2323 local query
24- query=$( curl -sG " https://eu.posthog.com/api/projects/$PROJ /insights/" \
24+ query=$( curl -sG -A " entur-geocoder " " https://eu.posthog.com/api/projects/$PROJ /insights/" \
2525 -H " Authorization: Bearer $TOKEN " \
2626 --data-urlencode " short_id=$short_id " \
2727 | jq " .results[0].query | .source.breakdownFilter.breakdown_limit = $LIMIT " )
28- curl -s " https://eu.posthog.com/api/projects/$PROJ /query/" \
28+ curl -s -A " entur-geocoder " " https://eu.posthog.com/api/projects/$PROJ /query/" \
2929 -H " Authorization: Bearer $TOKEN " \
3030 -H " Content-Type: application/json" \
3131 -d " {\" query\" : $query }"
Original file line number Diff line number Diff line change 3434 steps :
3535 - name : Download ${{ matrix.source.name }}
3636 run : |
37- curl -fL --retry 3 --retry-delay 10 -o "${{ matrix.source.filename }}" "${{ matrix.source.url }}"
37+ curl -fL --retry 3 --retry-delay 10 -A "entur-geocoder" - o "${{ matrix.source.filename }}" "${{ matrix.source.url }}"
3838 ls -lh "${{ matrix.source.filename }}"
3939
4040 - name : Verify file size
Original file line number Diff line number Diff line change 1313 - name : Check Photon import date
1414 id : check
1515 run : |
16- INFO=$(curl -sf https://api.entur.io/geocoder/v2/info)
16+ INFO=$(curl -sf -A "entur-geocoder" https://api.entur.io/geocoder/v2/info)
1717 IMPORT_DATE=$(echo "$INFO" | jq -r '.photonImportDate')
1818
1919 echo "Import date: $IMPORT_DATE"
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ case "$TAG_INPUT" in
1818 latest|latest-prod)
1919 POINTER_URL=" https://storage.googleapis.com/${BUCKET} /${PREFIX} /${TAG_INPUT} .txt"
2020 echo " Resolving $TAG_INPUT pointer: $POINTER_URL "
21- TAG=$( curl -fsSL " $POINTER_URL " | tr -d ' [:space:]' )
21+ TAG=$( curl -fsSL -A " entur-geocoder " " $POINTER_URL " | tr -d ' [:space:]' )
2222 ;;
2323 * )
2424 TAG=" $TAG_INPUT "
2727
2828URL=" https://storage.googleapis.com/${BUCKET} /${PREFIX} /${TAG} /${FILENAME} "
2929echo " Downloading $URL "
30- curl -fL --retry 3 --retry-delay 10 -o " $FILENAME " " $URL "
30+ curl -fL --retry 3 --retry-delay 10 -A " entur-geocoder " - o " $FILENAME " " $URL "
3131ls -lh " $FILENAME "
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ case "$TAG_INPUT" in
2020 latest|latest-prod)
2121 POINTER_URL=" https://storage.googleapis.com/${BUCKET} /${PREFIX} /${TAG_INPUT} .txt"
2222 echo " Resolving $TAG_INPUT pointer: $POINTER_URL "
23- TAG=$( curl -fsSL " $POINTER_URL " | tr -d ' [:space:]' )
23+ TAG=$( curl -fsSL -A " entur-geocoder " " $POINTER_URL " | tr -d ' [:space:]' )
2424 ;;
2525 * )
2626 TAG=" $TAG_INPUT "
@@ -32,9 +32,9 @@ echo "Downloading $URL"
3232
3333TARBALL=$( mktemp)
3434trap ' rm -f "$TARBALL"' EXIT
35- curl -fL --retry 3 --retry-delay 10 -o " $TARBALL " " $URL "
35+ curl -fL --retry 3 --retry-delay 10 -A " entur-geocoder " - o " $TARBALL " " $URL "
3636
37- EXPECTED=$( curl -fsSL --retry 3 --retry-delay 5 " ${URL} .sha256" | tr -d ' [:space:]' )
37+ EXPECTED=$( curl -fsSL --retry 3 --retry-delay 5 -A " entur-geocoder " " ${URL} .sha256" | tr -d ' [:space:]' )
3838ACTUAL=$( sha256sum " $TARBALL " | awk ' {print $1}' )
3939if [ " $EXPECTED " != " $ACTUAL " ]; then
4040 echo " checksum mismatch: expected $EXPECTED got $ACTUAL " >&2
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ if [ ! -f "$BINARY" ]; then
3838 * ) fail " Unsupported OS: $OS " ;;
3939 esac
4040 echo " Downloading nominatim-converter $VERSION ..."
41- curl -sfL --retry 2 " $BASE_URL /$ARTIFACT " -o " $BINARY "
41+ curl -sfL --retry 2 -A " entur-geocoder " " $BASE_URL /$ARTIFACT " -o " $BINARY "
4242 chmod +x " $BINARY "
4343fi
4444
@@ -104,7 +104,7 @@ START_TIME=$(date +%s)
104104if [ -n " ${USAGE_URL:- } " ]; then
105105 USAGE_FILE=" ${TMPDIR:-/ tmp} /nominatim-usage.csv"
106106 echo " Downloading usage CSV: $USAGE_URL "
107- curl -sfL --retry 2 " $USAGE_URL " -o " $USAGE_FILE "
107+ curl -sfL --retry 2 -A " entur-geocoder " " $USAGE_URL " -o " $USAGE_FILE "
108108 echo " $( wc -l < " $USAGE_FILE " ) rows -> $USAGE_FILE "
109109fi
110110
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ set -euo pipefail
44
55PHOTON_JAR=https://github.com/entur/photon/releases/download/2026-05-04-apostrophe-s/photon-1.1.0.jar
66
7- curl -sfL --retry 2 -o photon.jar $PHOTON_JAR && echo photon.jar downloaded successfully && exit 0
7+ curl -sfL --retry 2 -A " entur-geocoder " - o photon.jar $PHOTON_JAR && echo photon.jar downloaded successfully && exit 0
88
99echo ERROR: failed downloading photon.jar && exit 1
Original file line number Diff line number Diff line change @@ -27,10 +27,10 @@ if [ ! -f "$SENTINEL" ]; then
2727 echo " Downloading $PHOTON_DATA_URL "
2828 TARBALL=$( mktemp)
2929 trap ' rm -f "$TARBALL"' EXIT
30- curl -fL --retry 3 --retry-delay 10 --connect-timeout 30 -o " $TARBALL " " $PHOTON_DATA_URL "
30+ curl -fL --retry 3 --retry-delay 10 --connect-timeout 30 -A " entur-geocoder " - o " $TARBALL " " $PHOTON_DATA_URL "
3131
3232 # CI always uploads .sha256 alongside the tarball; treat its absence as an error.
33- EXPECTED=$( curl -fsSL --retry 3 --retry-delay 5 " ${PHOTON_DATA_URL} .sha256" | tr -d ' [:space:]' )
33+ EXPECTED=$( curl -fsSL --retry 3 --retry-delay 5 -A " entur-geocoder " " ${PHOTON_DATA_URL} .sha256" | tr -d ' [:space:]' )
3434 ACTUAL=$( sha256sum " $TARBALL " | awk ' {print $1}' )
3535 if [ " $EXPECTED " != " $ACTUAL " ]; then
3636 echo " checksum mismatch: expected $EXPECTED got $ACTUAL " >&2
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude
44import com.fasterxml.jackson.databind.ObjectMapper
55import io.ktor.client.*
66import io.ktor.client.engine.cio.*
7+ import io.ktor.client.plugins.UserAgent
78import io.ktor.http.*
89import io.ktor.serialization.jackson.*
910import io.ktor.server.application.*
@@ -180,6 +181,9 @@ class App {
180181
181182 private val httpClient =
182183 HttpClient (CIO ) {
184+ install(UserAgent ) {
185+ agent = " entur-geocoder-proxy"
186+ }
183187 install(ClientContentNegotiation ) {
184188 jackson()
185189 }
You can’t perform that action at this time.
0 commit comments