Patch qBittorrent config via initContainer before startup
Adds qbt-config-patch initContainer that sets WebUI\LocalhostAuthEnabled=false in qBittorrent.conf before the main containers start. Prevents qBittorrent from overwriting the setting (previously edited at runtime, lost on pod restart).
This commit is contained in:
@@ -34,6 +34,26 @@ spec:
|
||||
command: ["sh", "-c", "mkdir -p /dev/net && [ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 && chmod 666 /dev/net/tun && sysctl -w net.ipv6.conf.all.disable_ipv6=1 || true && ip route flush table 51820 2>/dev/null || true && ip rule del priority 101 2>/dev/null || true && ip rule del table 51820 2>/dev/null || true"]
|
||||
securityContext:
|
||||
privileged: true
|
||||
- name: qbt-config-patch
|
||||
image: busybox:latest
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
CONF=/config/qBittorrent/qBittorrent.conf
|
||||
mkdir -p /config/qBittorrent
|
||||
if [ -f "$CONF" ]; then
|
||||
if grep -q "LocalhostAuthEnabled" "$CONF"; then
|
||||
sed -i 's/LocalhostAuthEnabled=.*/LocalhostAuthEnabled=false/' "$CONF"
|
||||
else
|
||||
sed -i '/^\[Preferences\]/a WebUI\\LocalhostAuthEnabled=false' "$CONF" || \
|
||||
printf '\n[Preferences]\nWebUI\\LocalhostAuthEnabled=false\n' >> "$CONF"
|
||||
fi
|
||||
fi
|
||||
echo "Config patched: $(grep LocalhostAuth $CONF 2>/dev/null || echo 'will be set on first run')"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
containers:
|
||||
- name: gluetun
|
||||
image: ghcr.io/qdm12/gluetun:latest
|
||||
@@ -188,6 +208,26 @@ spec:
|
||||
command: ["sh", "-c", "mkdir -p /dev/net && [ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 && chmod 666 /dev/net/tun && sysctl -w net.ipv6.conf.all.disable_ipv6=1 || true && ip route flush table 51820 2>/dev/null || true && ip rule del priority 101 2>/dev/null || true && ip rule del table 51820 2>/dev/null || true"]
|
||||
securityContext:
|
||||
privileged: true
|
||||
- name: qbt-config-patch
|
||||
image: busybox:latest
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
CONF=/config/qBittorrent/qBittorrent.conf
|
||||
mkdir -p /config/qBittorrent
|
||||
if [ -f "$CONF" ]; then
|
||||
if grep -q "LocalhostAuthEnabled" "$CONF"; then
|
||||
sed -i 's/LocalhostAuthEnabled=.*/LocalhostAuthEnabled=false/' "$CONF"
|
||||
else
|
||||
sed -i '/^\[Preferences\]/a WebUI\\LocalhostAuthEnabled=false' "$CONF" || \
|
||||
printf '\n[Preferences]\nWebUI\\LocalhostAuthEnabled=false\n' >> "$CONF"
|
||||
fi
|
||||
fi
|
||||
echo "Config patched: $(grep LocalhostAuth $CONF 2>/dev/null || echo 'will be set on first run')"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
containers:
|
||||
- name: gluetun
|
||||
image: ghcr.io/qdm12/gluetun:latest
|
||||
|
||||
@@ -27,6 +27,27 @@ spec:
|
||||
command: ["sh", "-c", "mkdir -p /dev/net && [ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 && chmod 666 /dev/net/tun && sysctl -w net.ipv6.conf.all.disable_ipv6=1 || true && ip route flush table 51820 2>/dev/null || true && ip rule del priority 101 2>/dev/null || true && ip rule del table 51820 2>/dev/null || true"]
|
||||
securityContext:
|
||||
privileged: true
|
||||
# Patch qBittorrent config before it starts so localhost auth is disabled from boot
|
||||
- name: qbt-config-patch
|
||||
image: busybox:latest
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
CONF=/config/qBittorrent/qBittorrent.conf
|
||||
mkdir -p /config/qBittorrent
|
||||
if [ -f "$CONF" ]; then
|
||||
if grep -q "LocalhostAuthEnabled" "$CONF"; then
|
||||
sed -i 's/LocalhostAuthEnabled=.*/LocalhostAuthEnabled=false/' "$CONF"
|
||||
else
|
||||
sed -i '/^\[Preferences\]/a WebUI\\LocalhostAuthEnabled=false' "$CONF" || \
|
||||
printf '\n[Preferences]\nWebUI\\LocalhostAuthEnabled=false\n' >> "$CONF"
|
||||
fi
|
||||
fi
|
||||
echo "Config patched: $(grep LocalhostAuth $CONF 2>/dev/null || echo 'will be set on first run')"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
containers:
|
||||
- name: gluetun
|
||||
image: ghcr.io/qdm12/gluetun:latest
|
||||
|
||||
Reference in New Issue
Block a user