Fix substitute condition & docs

This commit is contained in:
Pierre Belanger 2023-01-07 16:58:11 -05:00
parent 6c2e2d7b6d
commit 072c851956
2 changed files with 4 additions and 7 deletions

View File

@ -52,10 +52,9 @@ mqtt:
# NOTE: must be unique if you are running multiple instances
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
user: mqtt_user
# 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

@ -863,12 +863,10 @@ class FrigateConfig(FrigateBaseModel):
"""Merge camera config with globals."""
config = self.copy(deep=True)
# MQTT password substitution
if config.mqtt.password:
config.mqtt.password = config.mqtt.password.format(**FRIGATE_ENV_VARS)
# MQTT user substitution
if config.mqtt.user:
# MQTT user/password substitutions
if config.mqtt.user or config.mqtt.password:
config.mqtt.user = config.mqtt.user.format(**FRIGATE_ENV_VARS)
config.mqtt.password = config.mqtt.password.format(**FRIGATE_ENV_VARS)
# Global config to propagate down to camera level
global_config = config.dict(