Skip to content

Commit 8da55c2

Browse files
authored
fix: replace eval with sed + exit if PROM_REMOTE_WRITE_TOKEN is empty (#301)
1 parent a6281d9 commit 8da55c2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ services:
153153
user: ":"
154154
networks: [dvnode]
155155
environment:
156-
PROM_REMOTE_WRITE_TOKEN: ${PROM_REMOTE_WRITE_TOKEN:-"obol-monitoring-token-needed"}
156+
PROM_REMOTE_WRITE_TOKEN: ${PROM_REMOTE_WRITE_TOKEN}
157157
SERVICE_OWNER: ${SERVICE_OWNER:-"obol-cdvn"}
158158
volumes:
159159
- ./prometheus:/etc/prometheus

prometheus/run.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ fi
77

88
if [ -z "$PROM_REMOTE_WRITE_TOKEN" ]
99
then
10-
echo "\$PROM_REMOTE_WRITE_TOKEN variable is empty"
10+
echo "\$PROM_REMOTE_WRITE_TOKEN variable is empty" >&2
11+
exit 1
1112
fi
1213

13-
# eval is used instead of envsubst, as prometheus user doesn't have permissions to install envsubst
14-
eval "echo \"$(cat /etc/prometheus/prometheus.yml.example)\"" > /etc/prometheus/prometheus.yml
14+
15+
sed "s|\$PROM_REMOTE_WRITE_TOKEN|${PROM_REMOTE_WRITE_TOKEN}|g" \
16+
/etc/prometheus/prometheus.yml.example > /etc/prometheus/prometheus.yml
1517

1618
/bin/prometheus \
1719
--config.file=/etc/prometheus/prometheus.yml

0 commit comments

Comments
 (0)