Fix influxdb2 configuration

This commit is contained in:
Franck Nijhof 2023-05-08 18:14:20 +02:00
parent 2b3bca3e98
commit f84276fac2
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
2 changed files with 12 additions and 5 deletions

View file

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

View file

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