Read log level from configuration and update readme

- Break out reading of settings in js and remove it from shell scripts
- Pick up config from Logger via Configuration class
This commit is contained in:
Victor Hagelbäck 2021-01-21 23:40:59 +01:00
parent 4176cfb714
commit 1b55cabf63
7 changed files with 90 additions and 34 deletions

View file

@ -1,33 +1,4 @@
#!/usr/bin/with-contenv bashio
CONFIG_PATH=/data/options.json
SITE=$(jq --raw-output ".site" $CONFIG_PATH)
USERNAME=$(jq --raw-output ".username" $CONFIG_PATH)
PASSWORD=$(jq --raw-output ".password" $CONFIG_PATH)
MQTTBROKER=$(jq --raw-output ".mqttBroker" $CONFIG_PATH)
MQTTUSERNAME=$(jq --raw-output ".mqttUsername" $CONFIG_PATH)
MQTTPASSWORD=$(jq --raw-output ".mqttPassword" $CONFIG_PATH)
INCLUDEROOMSASLIGHTS=$(jq --raw-output ".includeRoomsAsLights" $CONFIG_PATH)
CONNECTIONTIMEOUT=$(jq --raw-output ".connectionTimeout" $CONFIG_PATH)
WRITEQUEUEWAITTIME=$(jq --raw-output ".writeQueueWaitTime" $CONFIG_PATH)
PLEJD_PATH=/data/plejd.json
PLEJD_CONFIG="{
\"site\": \"$SITE\",
\"username\": \"$USERNAME\",
\"password\": \"$PASSWORD\",
\"mqttBroker\": \"$MQTTBROKER\",
\"mqttUsername\": \"$MQTTUSERNAME\",
\"mqttPassword\": \"$MQTTPASSWORD\",
\"includeRoomsAsLights\": \"$INCLUDEROOMSASLIGHTS\",
\"connectionTimeout\": \"$CONNECTIONTIMEOUT\",
\"writeQueueWaitTime\": \"$WRITEQUEUEWAITTIME\"
}
"
bashio::log.info 'Wrote plejd.json'
echo "$PLEJD_CONFIG" > $PLEJD_PATH
bashio::log.info 'Running add-on'
exec node /plejd/main.js
exec node /plejd/main.js