read in cli options

This commit is contained in:
Girish Ramakrishnan 2023-07-11 19:11:15 +05:30
parent ce47fe79fb
commit c35bfa6977
2 changed files with 10 additions and 3 deletions

View file

@ -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"

View file

@ -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}