feat: enhance Dockerfile for SQLite support and update main.go for MySQL connection; add sensor creation endpoint and improve wait-for-mqtt script

This commit is contained in:
2026-01-10 14:20:38 +01:00
parent a6196cc0ee
commit 81677943c4
5 changed files with 89 additions and 35 deletions
+18 -1
View File
@@ -18,5 +18,22 @@ while ! nc -z "$HOST" "$PORT"; do
sleep 1
done
echo "Broker $HOST:$PORT is up, starting server"
echo "Broker $HOST:$PORT is up"
# Optionally wait for MySQL if DB_HOST/DB_PORT are set
DB_HOST=${DB_HOST:-}
DB_PORT=${DB_PORT:-}
if [ -n "$DB_HOST" ]; then
if [ -z "$DB_PORT" ]; then
DB_PORT=3306
fi
echo "Waiting for MySQL $DB_HOST:$DB_PORT..."
while ! nc -z "$DB_HOST" "$DB_PORT"; do
echo "mysql not ready, retrying..."
sleep 1
done
echo "MySQL $DB_HOST:$DB_PORT is up"
fi
echo "Starting server"
exec /usr/local/bin/server