Skip to content

Commit

Permalink
allow mqtt password to be set by env var
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Mar 1, 2020
1 parent 7bad89c commit 30ad0e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions detect_objects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import cv2
import time
import datetime
Expand All @@ -16,6 +17,8 @@
from frigate.util import EventsPerSecond
from frigate.edgetpu import EdgeTPUProcess

FRIGATE_VARS = {k: v for k, v in os.environ.items() if k.startswith('FRIGATE_')}

with open('/config/config.yml') as f:
CONFIG = yaml.safe_load(f)

Expand All @@ -24,6 +27,8 @@
MQTT_TOPIC_PREFIX = CONFIG.get('mqtt', {}).get('topic_prefix', 'frigate')
MQTT_USER = CONFIG.get('mqtt', {}).get('user')
MQTT_PASS = CONFIG.get('mqtt', {}).get('password')
if not MQTT_PASS is None:
MQTT_PASS = MQTT_PASS.format(**FRIGATE_VARS)
MQTT_CLIENT_ID = CONFIG.get('mqtt', {}).get('client_id', 'frigate')

# Set the default FFmpeg config
Expand Down

0 comments on commit 30ad0e3

Please sign in to comment.