mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-01 09:43:32 +02:00
birdnet-go: guard SQLite revert to only run when HA MariaDB host matches
When mariadb_auto_config is disabled, only revert output.mysql.enabled to false (and re-enable SQLite) if config.yaml's output.mysql.host matches the HA MariaDB service host. This prevents clobbering a manually-configured MySQL block pointing at a different server on every addon restart.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## nightly-20260615-2 (2026-06-23)
|
||||
- MariaDB auto-config: create the `birdnet` database on first start if it does not exist (birdnet-go connects to a pre-existing schema and does not create it, causing "database doesn't exist" errors)
|
||||
- MariaDB auto-config: disabling `mariadb_auto_config` now writes `output.mysql.enabled = false` and `output.sqlite.enabled = true` back to config.yaml, so turning the option off fully reverts to SQLite
|
||||
- MariaDB auto-config: disabling `mariadb_auto_config` now reverts to SQLite only when `output.mysql.host` in config.yaml matches the HA MariaDB host (avoids clobbering manually-configured MySQL pointing at a different server)
|
||||
- Added `mariadb-client` to the addon packages so the `mysql` CLI used for database creation is available inside the container
|
||||
|
||||
- MQTT auto-config now also enables BirdNET-Go's native Home Assistant MQTT auto-discovery: detection sensors appear in Home Assistant automatically with no manual YAML (existing UI/config.yaml edits are preserved)
|
||||
|
||||
@@ -41,12 +41,17 @@ if ! bashio::config.true 'mariadb_auto_config'; then
|
||||
bashio::log.blue "Port : ${MYSQL_PORT}"
|
||||
bashio::log.green "---"
|
||||
if [ -f "$CONFIG_LOCATION" ]; then
|
||||
# Revert any previously written mysql block so the app uses SQLite.
|
||||
# Only revert if config.yaml points at the HA MariaDB host we would have
|
||||
# written — a mysql block pointing at a different host was set manually.
|
||||
# shellcheck disable=SC2016
|
||||
yq -i -y \
|
||||
'.output.mysql.enabled = false
|
||||
| .output.sqlite.enabled = true' \
|
||||
"$CONFIG_LOCATION"
|
||||
CURRENT_MYSQL_HOST="$(yq -r '.output.mysql.host // empty' "$CONFIG_LOCATION" 2>/dev/null || true)"
|
||||
if yq -e '.output.mysql.enabled == true' "$CONFIG_LOCATION" >/dev/null 2>&1 \
|
||||
&& [ "${CURRENT_MYSQL_HOST}" = "${MYSQL_HOST}" ]; then
|
||||
yq -i -y \
|
||||
'.output.mysql.enabled = false
|
||||
| .output.sqlite.enabled = true' \
|
||||
"$CONFIG_LOCATION"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user