From c35bfa697758bd423691c919a2131fc39b81dded Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 11 Jul 2023 19:11:15 +0530 Subject: [PATCH] read in cli options --- env.sh.template | 2 ++ start.sh | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/env.sh.template b/env.sh.template index b479aee..d9248ba 100755 --- a/env.sh.template +++ b/env.sh.template @@ -2,3 +2,5 @@ # https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects export retention_time="15d" + +export cli_options="--storage.tsdb.retention.time=$retention_time --storage.tsdb.path=/app/data/runtime" diff --git a/start.sh b/start.sh index e987933..2e8f32b 100755 --- a/start.sh +++ b/start.sh @@ -18,8 +18,13 @@ if [[ ! -f /app/data/env.sh ]]; then cp /app/pkg/env.sh.template /app/data/env.sh fi -echo "=> Source custom variables" +# migration remove in next release +if ! grep -q cli_option /app/data/env.sh; then + echo -e '\nexport cli_options="--storage.tsdb.retention.time=$retention_time --storage.tsdb.path=/app/data/runtime"' >> /app/data/env.sh +fi + +echo "=> Source custom variables for cli args" source /app/data/env.sh -echo "=> Starting Prometheus with retention time of $retention_time" -exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime --storage.tsdb.retention.time="${retention_time:-15d}" +echo "=> Starting Prometheus" +exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml ${cli_options}