#!/command/with-contenv bashio # shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: Grafana # Configures Grafana # ============================================================================== readonly CONFIG="/etc/grafana/grafana.ini" declare ingress_entry declare log_level # Symlink the new style config directory to the old one. People might have # configurations for Grafana that access the database via the old path. ln -s "/homeassistant" "/config" \ || bashio::log.warning "Failed linking Home Assistant configuration alias" # Configures Grafana with the add-on log level log_level="Info" if bashio::config.exists 'log_level'; then case "$(bashio::string.lower "$(bashio::config 'log_level')")" in all|trace) log_level="Trace" ;; debug) log_level="Debug" ;; info|notice) log_level="Info" ;; warning) log_level="Warn" ;; error) log_level="Error" ;; fatal|off) log_level="Critical" ;; esac fi sed -i "s/level = Info/level = ${log_level}/g" "${CONFIG}" # Sets unique secret key used for signing cookies. if ! bashio::fs.file_exists "/data/secret"; then echo "${SUPERVISOR_TOKEN}" > /data/secret fi secret=$(