Support for dynamic MQTT user configuration #4883

This commit is contained in:
Pierre Belanger 2023-01-07 16:35:50 -05:00
parent 57dce4ec38
commit 6c2e2d7b6d
2 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,9 @@ mqtt:
client_id: frigate
# Optional: user
user: mqtt_user
# NOTE: MQTT user can be specified with an environment variables that must begin with 'FRIGATE_'.
# e.g. user: '{FRIGATE_MQTT_USER}'
password: password
# Optional: password
# NOTE: MQTT password can be specified with an environment variables that must begin with 'FRIGATE_'.
# e.g. password: '{FRIGATE_MQTT_PASSWORD}'

View File

@ -866,6 +866,9 @@ class FrigateConfig(FrigateBaseModel):
# MQTT password substitution
if config.mqtt.password:
config.mqtt.password = config.mqtt.password.format(**FRIGATE_ENV_VARS)
# MQTT user substitution
if config.mqtt.user:
config.mqtt.user = config.mqtt.user.format(**FRIGATE_ENV_VARS)
# Global config to propagate down to camera level
global_config = config.dict(