Update main.py

Add * for tags wildcard & default NAMESPACE to None.
This commit is contained in:
Leigh Phillips 2021-01-16 15:29:59 -08:00 committed by GitHub
parent 61d3405928
commit 981fdad9a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import os
from influxdb import InfluxDBClient
# InfluxDB Settings
NAMESPACE = os.getenv('NAMESPACE', '')
NAMESPACE = os.getenv('NAMESPACE', 'None')
DB_ADDRESS = os.getenv('INFLUX_DB_ADDRESS', 'influxdb')
DB_PORT = int(os.getenv('INFLUX_DB_PORT', '8086'))
DB_USER = os.getenv('INFLUX_DB_USER', '')
@ -66,12 +66,16 @@ def tag_selection(data):
'speedtest_url': data['result']['url']
}
if tags == '*':
return tag_switch
options = {}
tags = tags.split(',')
for tag in tags:
# split the tag string, strip and add selected tags to {options} with corresponding tag_switch data
tag = tag.strip()
options[tag] = tag_switch[tag]
return options