secret: parse API_SECRET/TZ if NS_SECRET/TIMEZONE_NAME are missing

This commit is contained in:
James Woglom
2022-01-04 21:02:20 -05:00
parent 3a400390de
commit 7b06f1c457
3 changed files with 10 additions and 4 deletions
Generated
+3 -3
View File
@@ -46,11 +46,11 @@
},
"charset-normalizer": {
"hashes": [
"sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721",
"sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"
"sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd",
"sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455"
],
"markers": "python_version >= '3'",
"version": "==2.0.9"
"version": "==2.0.10"
},
"idna": {
"hashes": [
+3 -1
View File
@@ -41,6 +41,7 @@ The following synchronization feature is disabled by default, but can be enabled
## Setup
The following setup instructions assume that you have a Linux, MacOS, or Windows (with WSL) machine that will run the application continuously.
If you've configured Nightscout before, you may be familiar with Heroku. [You can opt to run tconnectsync with Heroku by following these instructions.](https://github.com/jwoglom/tconnectsync-heroku)
**To get started,** you need to choose whether to install the application on your computer via
@@ -67,8 +68,9 @@ TCONNECT_PASSWORD='password'
# Your pump's serial number (numeric)
PUMP_SERIAL_NUMBER=11111111
# URL and API secret for Nightscout
# URL of your Nightscout site
NS_URL='https://yournightscouturl/'
# Your Nightscout API_SECRET value
NS_SECRET='apisecret'
# Current timezone of the pump
+4
View File
@@ -36,6 +36,10 @@ PUMP_SERIAL_NUMBER = get_number('PUMP_SERIAL_NUMBER', '11111111')
NS_URL = get('NS_URL', 'https://yournightscouturl/')
NS_SECRET = get('NS_SECRET', 'apisecret')
if not get('NS_SECRET') and get('API_SECRET'):
print('API_SECRET environment variable is set, overriding NS_SECRET')
NS_SECRET = get('API_SECRET')
TIMEZONE_NAME = get('TIMEZONE_NAME', 'America/New_York')
if not get('TIMEZONE_NAME') and get('TZ'):