fix(music): add lavasrc-patcher sidecar for auto-applying runtime config

LavaSrc plugin config (preferPartnerApi, customTokenEndpoint, spDc)
doesn't bind from YAML in Lavalink 4. Added a one-shot sidecar container
that applies the config via PATCH endpoint after Lavalink becomes healthy.
Also cleaned up DEBUG logging.
This commit is contained in:
loki5512344 2026-08-31 16:22:14 +02:00
parent af88cea301
commit affdb684b9
Signed by: boba
GPG key ID: 253067914055423B
3 changed files with 31 additions and 0 deletions

View file

@ -31,6 +31,16 @@ services:
retries: 3 retries: 3
start_period: 20s start_period: 20s
lavasrc-patcher:
build:
context: ./lavalink
dockerfile: Dockerfile.config-patcher
container_name: lavasrc-patcher
depends_on:
lavalink:
condition: service_healthy
restart: "no"
bot: bot:
build: . build: .
container_name: loki-bot container_name: loki-bot

View file

@ -0,0 +1,5 @@
FROM alpine:3.20
RUN apk add --no-cache curl
COPY apply-config.sh /apply-config.sh
RUN chmod +x /apply-config.sh
CMD ["/apply-config.sh"]

16
lavalink/apply-config.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
# Apply LavaSrc runtime config after Lavalink starts
until curl -sf -H "Authorization: Hch4HiVCxkKs9JPiSnrt4Q" http://lavalink:2333/v4/info >/dev/null 2>&1; do
sleep 2
done
sleep 5
curl -sf -X PATCH \
-H "Authorization: Hch4HiVCxkKs9JPiSnrt4Q" \
-H "Content-Type: application/json" \
-d '{"spotify":{"preferPartnerApi":true,"customTokenEndpoint":"http://spotify-tokener:8080/api/token","spDc":"AQDVrLVOyLLT3ZuiLoY32uH8HotvY_Lw67ay1lejf55S7O3f_O9IefxZ8XDf3pYklpwl5Klei2NeYUPRZ-cbkpQg5S3RyMjuiTmBxdAuMlugA61_wAy-bXD979aYDK44Bid6UKxLHjh0kFQZ_tX71DAUGezA2XjeLcRi_-TLcKHWKZVKPhGniUOZZEhg2Ij9t6valbqSbDOQ1t0dtQ"}}' \
http://lavalink:2333/v4/lavasrc/config
echo "LavaSrc config applied"