#!/bin/sh set -eu integration_token_file=/run/secrets/integration_token admin_password_file=/run/secrets/grafana_admin_password secret_key_file=/run/secrets/grafana_secret_key if [ ! -r "$integration_token_file" ] || [ ! -r "$admin_password_file" ] || [ ! -r "$secret_key_file" ]; then echo "required Grafana secret file is unavailable" >&2 exit 1 fi INTEGRATION_TOKEN=$(tr -d '\r\n' < "$integration_token_file") GF_SECURITY_ADMIN_PASSWORD=$(tr -d '\r\n' < "$admin_password_file") GF_SECURITY_SECRET_KEY=$(tr -d '\r\n' < "$secret_key_file") if [ "${#INTEGRATION_TOKEN}" -lt 32 ] || [ "${#GF_SECURITY_ADMIN_PASSWORD}" -lt 16 ] || [ "${#GF_SECURITY_SECRET_KEY}" -lt 32 ]; then echo "Grafana secrets do not meet minimum length requirements" >&2 exit 1 fi export INTEGRATION_TOKEN GF_SECURITY_ADMIN_PASSWORD GF_SECURITY_SECRET_KEY exec /run.sh