From 2e32afbe83470069b96deb2d9e68cdea0c29f149 Mon Sep 17 00:00:00 2001 From: breadlysm Date: Sat, 18 Jul 2020 10:59:00 -0400 Subject: [PATCH] Updated to use ENV Vars --- main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index dd37dbf..8e5e5b2 100755 --- a/main.py +++ b/main.py @@ -1,19 +1,20 @@ import time import json import subprocess +import os from influxdb import InfluxDBClient # InfluxDB Settings -DB_ADDRESS = 'db_hostname.network' -DB_PORT = 8086 -DB_USER = 'db_username' -DB_PASSWORD = 'db_password' -DB_DATABASE = 'speedtest_db' +DB_ADDRESS = os.environ.get('INFLUX_DB_ADDRESS') +DB_PORT = os.environ.get('INFLUX_DB_PORT') +DB_USER = os.environ.get('INFLUX_DB_USER') +DB_PASSWORD = os.environ.get('INFLUX_DB_PASSWORD') +DB_DATABASE = os.environ.get('INFLUX_DB_DATABASE') # Speedtest Settings -TEST_INTERVAL = 1800 # Time between tests (in seconds). -TEST_FAIL_INTERVAL = 60 # Time before retrying a failed Speedtest (in seconds). +TEST_INTERVAL = os.environ.get('SPEEDTEST_INTERVAL') # Time between tests (in seconds). +TEST_FAIL_INTERVAL = os.environ.get('SPEEDTEST_FAIL_INTERVAL') # Time before retrying a failed Speedtest (in seconds). influxdb_client = InfluxDBClient( DB_ADDRESS, DB_PORT, DB_USER, DB_PASSWORD, None)