Files
hassio-addons/birdnet-go/rootfs/etc/nginx/nginx.conf
Claude 2087da7f18 birdnet-go: harden config init, auto-wire MQTT/MariaDB, trim ingress proxy
Bugs fixed in 01-structure.sh:
- Database backup created during BIRDSONGS_FOLDER migration was written
  to the script's CWD instead of /config, and the restore path was
  recomputed with a fresh timestamp — so any second-boundary crossing
  between backup and restore left the user unable to recover. Backup
  path is now absolute and reused for restore.
- Path inputs are validated against [A-Za-z0-9._/-]+ before being
  interpolated into the SQL UPDATE statement.
- Default-config download tolerates network failure instead of leaving
  an empty config.yaml behind.
- output.sqlite.path and logging.file_output.* are now seeded with the
  "set-if-missing" idiom (`//=`) so user edits to config.yaml survive
  restarts. (Breaking: addon options for log rotation now only seed
  defaults on first run.)
- Path normalization centralized; trailing-slash juggling removed.

UX upgrades:
- 33-mqtt.sh now auto-configures realtime.mqtt.* in config.yaml from
  the HA Mosquitto addon (with new mqtt_disable opt-out option).
- 33-mariadb.sh now auto-switches output.mysql.* to the HA MariaDB
  addon and disables SQLite (with mariadb_disable opt-out option).

Cleanup:
- Dockerfile: upstream entrypoint sed-patch now warns (not silently
  succeeds) when the target pattern is missing in a new nightly.
- Removed dead nginx upstream.conf pointing at unused port 8096.
- Trimmed redundant nginx HTML-attribute sub_filters; upstream
  birdnet-go handles those itself via X-Ingress-Path. JS string
  rewrites kept since the upstream HTML rewriter does not touch JS.
  (Breaking UI-side if upstream regresses — see CHANGELOG.)
2026-05-28 17:01:42 +00:00

82 lines
1.9 KiB
Nginx Configuration File

# Run nginx in foreground.
daemon off;
# This is run inside Docker.
user root;
# Pid storage location.
pid /var/run/nginx.pid;
# Set number of worker processes.
worker_processes auto;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Write error log to Hass.io add-on log.
error_log /proc/1/fd/1 error;
# Load allowed environment vars
env HASSIO_TOKEN;
# Load dynamic modules.
include /etc/nginx/modules/*.conf;
# Max num of simultaneous connections by a worker process.
events {
worker_connections 8192;
}
http {
include /etc/nginx/includes/mime.types;
# https://emby.media/community/index.php?/topic/93074-how-to-emby-with-nginx-with-windows-specific-tips-and-csp-options/
server_names_hash_bucket_size 64;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
proxy_connect_timeout 1h;
log_format hassio '[$time_local] $status '
'$http_x_forwarded_for($remote_addr) '
'$request ($http_user_agent)';
access_log /proc/1/fd/1 hassio;
client_max_body_size 4G;
default_type application/octet-stream;
gzip on;
keepalive_timeout 65;
sendfile on;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
map $time_iso8601 $today {
default "";
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/includes/resolver.conf;
include /etc/nginx/servers/*.conf;
}