Skip to content

Commit c127be7

Browse files
authored
fix(mqtt-broker): use conditional password file creation to prevent overwrite on restart (#1851)
1 parent 916155f commit c127be7

File tree

1 file changed

+5
-2
lines changed
  • metro-ai-suite/smart-nvr/charts/subchart/mqtt-broker/templates

1 file changed

+5
-2
lines changed

metro-ai-suite/smart-nvr/charts/subchart/mqtt-broker/templates/deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ spec:
9090
- sh
9191
- -c
9292
- |
93-
touch {{ .Values.auth.passwordFilePath }} && \
94-
mosquitto_passwd -c -b {{ .Values.auth.passwordFilePath }} $${MQTT_USER} $${MQTT_PASSWORD} && \
93+
if [ ! -f {{ .Values.auth.passwordFilePath }} ]; then
94+
mosquitto_passwd -c -b {{ .Values.auth.passwordFilePath }} $${MQTT_USER} $${MQTT_PASSWORD}
95+
else
96+
mosquitto_passwd -b {{ .Values.auth.passwordFilePath }} $${MQTT_USER} $${MQTT_PASSWORD}
97+
fi && \
9598
chmod 0700 {{ .Values.auth.passwordFilePath }} && \
9699
chown {{ $runUser }}:{{ $runGroup }} {{ .Values.auth.passwordFilePath }} && \
97100
mosquitto -c /mosquitto/config/mosquitto.conf

0 commit comments

Comments
 (0)