(fix) enable migration to postgresql recorder for existing configurations (#1130)

* (fix) enable migration to postgresql recorder for existing configurations and add some more tweaks

* me fix
This commit is contained in:
Kjeld Schouten-Lebbing
2021-10-13 14:22:10 +02:00
committed by GitHub
parent 8c3d78ac5a
commit 77ae8430ec
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -29,4 +29,4 @@ sources:
- https://github.com/home-assistant/home-assistant
- https://github.com/cdr/code-server
type: application
version: 8.1.1
version: 8.1.2
@@ -8,15 +8,17 @@ metadata:
data:
init.sh: |-
#!/bin/sh
echo "postgresql password: {{ ( printf "%v%v:%v@%v-%v:%v/%v?client_encoding=utf8" "postgresql://" .Values.postgresql.postgresqlUsername .Values.postgresql.Password .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | quote }}"
if test -f "/config/configuration.yaml"; then
echo "configuration.yaml exists."
if grep -q recorder: "/config/configuration.yaml"; then
echo "configuration.yaml already contains recorder"
else
cat /config/init/recorder.default >> /config/configuration.yaml
fi
else
echo "configuration.yaml does NOT exist."
cp /config/init/configuration.yaml.default /config/configuration.yaml
cat /config/init/recorder.default >> /config/configuration.yaml
fi
configuration.yaml.default: |-
# Configure a default setup of Home Assistant (frontend, api, etc)
@@ -31,8 +33,12 @@ data:
# automation: !include automations.yaml
# script: !include scripts.yaml
# scene: !include scenes.yaml
recorder.default: |-
recorder:
purge_keep_days: 30
commit_interval: 3
db_url: {{ ( printf "%s?client_encoding=utf8" ( .Values.postgresql.url.complete | trimAll "\"" ) ) | quote }}
{{- end -}}