zigbee2mqtt/test
Tom 08524953bf
Add Environment Variable Override (#4085)
* Add Environment Variable Override

I need to be able to manage settings on this service via Environment Variables.   I've added the ability to override anything in the settings schema with a corresponding environment variable.  

e.g. to override settings.serial.port you can set ZIGBEE2MQTT_SERIAL_PORT=/dev/ttyS0
to override the mqtt username you can set ZIGBEE2MQTT_MQTT_USER=testusername

This new addition will not perform any action on existing installations unless the matching environment variable is set.  I have tested this setting string, number, boolean, object and array values.

* Adding test case for environment variables and slight modification to ensure 100% code coverage.

* Adding a test to confirm that env variables will set non default values.  Also realized that I was errantly applying the env variables to the defaults for testing.  Understanding what this is doing more clearly I realize that should be clean.

* Refactoring to

1. Remove the test variables from the schema and defaults and manually reflect the tests in the test.

2. Rename environment variable base from ZIGBEE2MQTT_ to ZIGBEE2MQTT_CONFIG_

* Small improvements

* Removing the unneeded test.

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2020-08-13 23:50:30 +02:00
..
assets Support Home Assistant configuration for external converters. https://github.com/Koenkk/zigbee-herdsman-converters/issues/1343 2020-07-03 21:20:22 +02:00
legacy Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
stub Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
availability.test.js Prefer blocklist/passlist over blacklist/whitelist 2020-07-15 23:22:32 +02:00
bind.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
bridge.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
configure.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
controller.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
data.test.js Zigbee-herdsman (#1945) 2019-09-09 19:48:09 +02:00
externalConverters.test.js Support Home Assistant configuration for external converters. https://github.com/Koenkk/zigbee-herdsman-converters/issues/1343 2020-07-03 21:20:22 +02:00
group.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
homeassistant.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
logger.test.js Allow to disable log rotation. #3280 2020-04-04 19:46:43 +02:00
networkMap.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
onEvent.test.js Update converters. 2020-04-13 21:15:08 +02:00
otaUpdate.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
publish.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
receive.test.js Sort logged and published JSON objects alphabetically. #4091 2020-08-13 20:00:35 +02:00
report.test.js Disable reporting on device when reporting is disabled. https://github.com/Koenkk/zigbee2mqtt/issues/3826 2020-08-04 19:11:13 +02:00
settings.test.js Add Environment Variable Override (#4085) 2020-08-13 23:50:30 +02:00
utils.test.js Fix tests. 2019-11-06 20:51:31 +01:00