👌 Change SSL config to boolean

Also make config optional
This commit is contained in:
Paul Sinclair 2019-07-28 09:51:31 -04:00
parent e380d7ae39
commit 052974a750
No known key found for this signature in database
GPG key ID: 779C7A23E1AA845D
3 changed files with 14 additions and 8 deletions

View file

@ -71,7 +71,7 @@ Example add-on configuration:
"database": "glances",
"prefix": "localhost",
"interval": 60,
"protocol": "http"
"ssl": false
}
}
```
@ -174,10 +174,11 @@ The hostname to append for exported data.
Defines the interval (in seconds) on how often Glances exports data to InfluxDB.
#### Option `influxdb`: `protocol`
#### Option `influxdb`: `ssl`
Use `http` or `https` to connect to InfluxDB. Set to `http` if using the
Community InfluxDB add-on
Adding this option will allow SSL to be used on the InfluxDB connection. If not
set will default to `false` which is the required setting for the Community
InfluxDB add-on.
## Adding Glances as a sensor into Home Assistant

View file

@ -53,8 +53,7 @@
"password": "",
"database": "glances",
"prefix": "localhost",
"interval": 60,
"protocol": "http"
"interval": 60
}
},
"schema": {
@ -73,7 +72,7 @@
"database": "str",
"prefix": "str",
"interval": "int",
"protocol": "match(^(http|https)$)"
"ssl": "bool?"
},
"leave_front_door_open": "bool?"
},

View file

@ -3,6 +3,7 @@
# Community Hass.io Add-ons: Glances
# Configures Glances
# ==============================================================================
declare protocol
bashio::require.unprotected
# Ensure the configuration exists
@ -18,6 +19,11 @@ fi
# Export Glances data to InfluxDB
if bashio::config.true 'influxdb.enabled'; then
if bashio::config.true 'influxdb.ssl'; then
protocol='https'
else
protocol='http'
fi
# Modify the configuration
{
echo "[influxdb]"
@ -27,6 +33,6 @@ if bashio::config.true 'influxdb.enabled'; then
echo "password=$(bashio::config 'influxdb.password')"
echo "db=$(bashio::config 'influxdb.database')"
echo "prefix=$(bashio::config 'influxdb.prefix')"
echo "protocol=$(bashio::config 'influxdb.protocol')"
echo "protocol=${protocol}"
} >> /etc/glances.conf
fi