Skip to content

Commit 8f727c1

Browse files
committed
Fix Martin config to inject DATABASE_URL at startup via envsubst
Martin ignores DATABASE_URL env var when a config file is loaded, so we use envsubst to template the connection string into the config.
1 parent 68e4a40 commit 8f727c1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# ABOUTME: Docker build for Martin tile server on Railway.
2-
# ABOUTME: Copies config and serves tiles from PostGIS and /pmtiles volume.
2+
# ABOUTME: Copies config template and substitutes DATABASE_URL at startup.
33

44
FROM ghcr.io/maplibre/martin:latest
55

6-
COPY martin-railway.yaml /config/config.yaml
6+
USER root
7+
RUN apk add --no-cache gettext
8+
9+
COPY martin-railway.yaml /config/config.yaml.template
710

811
EXPOSE 3000
912

10-
CMD ["--config", "/config/config.yaml"]
13+
ENTRYPOINT ["sh", "-c", "envsubst < /config/config.yaml.template > /config/config.yaml && martin --config /config/config.yaml"]

truecover-backend/martin-railway.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cache_size_mb: 512
55
preferred_encoding: gzip
66

77
postgres:
8+
connection_string: ${DATABASE_URL}
89
auto_publish: true
910

1011
functions:

0 commit comments

Comments
 (0)