Fix influxdb2 configuration (#357)

This commit is contained in:
Franck Nijhof 2023-05-08 18:19:02 +02:00 committed by GitHub
parent 2b3bca3e98
commit 15406b58e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -64,11 +64,11 @@ schema:
enabled: bool enabled: bool
host: str host: str
port: port port: port
username: str username: str?
password: password password: password?
database: str database: str?
org: str? org: str?
prefix: str prefix: str?
interval: int interval: int
ssl: bool? ssl: bool?
token: str? token: str?

View file

@ -26,6 +26,10 @@ if bashio::config.true 'influxdb.enabled'; then
# Modify the configuration # Modify the configuration
if bashio::config.equals 'influxdb.version' '1'; then if bashio::config.equals 'influxdb.version' '1'; then
bashio::config.require "influxdb.username"
bashio::config.require "influxdb.password"
bashio::config.require "influxdb.database"
bashio::config.require "influxdb.prefix"
{ {
echo "[influxdb]" echo "[influxdb]"
echo "user=$(bashio::config 'influxdb.username')" echo "user=$(bashio::config 'influxdb.username')"
@ -34,6 +38,9 @@ if bashio::config.true 'influxdb.enabled'; then
echo "prefix=$(bashio::config 'influxdb.prefix')" echo "prefix=$(bashio::config 'influxdb.prefix')"
} >> /etc/glances.conf } >> /etc/glances.conf
elif bashio::config.equals 'influxdb.version' '2'; then elif bashio::config.equals 'influxdb.version' '2'; then
bashio::config.require "influxdb.org"
bashio::config.require "influxdb.bucket"
bashio::config.require "influxdb.token"
{ {
echo "[influxdb2]" echo "[influxdb2]"
echo "org=$(bashio::config 'influxdb.org')" echo "org=$(bashio::config 'influxdb.org')"