File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 4
4
import argparse
5
5
import logging .config
6
6
import sys
7
+ from os import getenv
7
8
from copy import deepcopy
8
9
from hashlib import sha256
9
10
from typing import Any , Optional
@@ -76,6 +77,16 @@ def main() -> None:
76
77
# Load, validate and normalise config, or quit.
77
78
try :
78
79
raw_config = load_config (args .config , args .render )
80
+ if raw_config :
81
+ if "mqtt" not in raw_config or raw_config ["mqtt" ] is None :
82
+ raw_config ["mqtt" ] = {}
83
+ raw_config ["mqtt" ]["host" ] = getenv ("MQTT_IO_HOST" , raw_config ["mqtt" ].get ("host" ))
84
+ raw_config ["mqtt" ]["port" ] = getenv ("MQTT_IO_PORT" , raw_config ["mqtt" ].get ("port" ))
85
+ raw_config ["mqtt" ]["user" ] = getenv ("MQTT_IO_USER" , raw_config ["mqtt" ].get ("user" ))
86
+ raw_config ["mqtt" ]["password" ] = getenv ("MQTT_IO_PASSWORD" ,
87
+ raw_config ["mqtt" ].get ("password" ))
88
+ raw_config ["mqtt" ]["protocol" ] = getenv ("MQTT_IO_PROTOCOL" ,
89
+ raw_config ["mqtt" ].get ("protocol" ))
79
90
config = validate_and_normalise_main_config (raw_config )
80
91
except ConfigValidationFailed as exc :
81
92
print (str (exc ), file = sys .stderr )
You can’t perform that action at this time.
0 commit comments