Update main.py
Try this again.
This commit is contained in:
parent
74ae03ba9f
commit
c54e30c200
1 changed files with 10 additions and 17 deletions
27
main.py
27
main.py
|
@ -4,29 +4,22 @@ import subprocess
|
||||||
import os
|
import os
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
|
|
||||||
func getEnv(key, fallback string) string {
|
|
||||||
if value, ok := os.LookupEnv(key); ok {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
return fallback
|
|
||||||
}
|
|
||||||
|
|
||||||
# InfluxDB Settings
|
# InfluxDB Settings
|
||||||
NAMESPACE = getEnv('NAMESPACE', '')
|
NAMESPACE = os.getenv('NAMESPACE', '')
|
||||||
DB_ADDRESS = getEnv('INFLUX_DB_ADDRESS', 'influxdb')
|
DB_ADDRESS = os.getenv('INFLUX_DB_ADDRESS', 'influxdb')
|
||||||
DB_PORT = int(getEnv('INFLUX_DB_PORT', '8086'))
|
DB_PORT = int(os.getenv('INFLUX_DB_PORT', '8086'))
|
||||||
DB_USER = getEnv('INFLUX_DB_USER', '')
|
DB_USER = os.getenv('INFLUX_DB_USER', '')
|
||||||
DB_PASSWORD = getEnv('INFLUX_DB_PASSWORD', '')
|
DB_PASSWORD = os.getenv('INFLUX_DB_PASSWORD', '')
|
||||||
DB_DATABASE = getEnv('INFLUX_DB_DATABASE', 'speedtests')
|
DB_DATABASE = os.getenv('INFLUX_DB_DATABASE', 'speedtests')
|
||||||
DB_TAGS = getEnv('INFLUX_DB_TAGS', '')
|
DB_TAGS = os.getenv('INFLUX_DB_TAGS', '')
|
||||||
|
|
||||||
# Speedtest Settings
|
# Speedtest Settings
|
||||||
# Time between tests (in minutes, converts to seconds).
|
# Time between tests (in minutes, converts to seconds).
|
||||||
TEST_INTERVAL = int(getEnv('SPEEDTEST_INTERVAL', '5')) * 60
|
TEST_INTERVAL = int(os.getenv('SPEEDTEST_INTERVAL', '5')) * 60
|
||||||
# Time before retrying a failed Speedtest (in minutes, converts to seconds).
|
# Time before retrying a failed Speedtest (in minutes, converts to seconds).
|
||||||
TEST_FAIL_INTERVAL = int(getEnv('SPEEDTEST_FAIL_INTERVAL', '5')) * 60
|
TEST_FAIL_INTERVAL = int(os.getenv('SPEEDTEST_FAIL_INTERVAL', '5')) * 60
|
||||||
# Specific server ID
|
# Specific server ID
|
||||||
SERVER_ID = getEnv('SPEEDTEST_SERVER_ID', '')
|
SERVER_ID = os.getenv('SPEEDTEST_SERVER_ID', '')
|
||||||
|
|
||||||
influxdb_client = InfluxDBClient(
|
influxdb_client = InfluxDBClient(
|
||||||
DB_ADDRESS, DB_PORT, DB_USER, DB_PASSWORD, None)
|
DB_ADDRESS, DB_PORT, DB_USER, DB_PASSWORD, None)
|
||||||
|
|
Loading…
Reference in a new issue