linuxserver / docker-qbittorrent

GNU General Public License v3.0
1.05k stars 155 forks source link

[BUG] container does not pass the envirnoment to custom servcices #319

Closed moralrebuild closed 1 month ago

moralrebuild commented 2 months ago

Is there an existing issue for this?

Current Behavior

custom scripts have no issue to pick up the environment variable but the custom services.

for e.g. adding a custom service in the container like:

pre_reqs() {
while read -r var; do
    [ -z "${!var}" ] && { echo "$(timestamp) | ${var} is empty or not set."; exit 1; }
done << EOF
QBITTORRENT_SERVER
QBITTORRENT_PORT
QBITTORRENT_USER
QBITTORRENT_PASS
VPN_GATEWAY
VPN_IF_NAME
CHECK_INTERVAL
NAT_LEASE_LIFETIME
EOF

return 0
}

Expected Behavior

No response

Steps To Reproduce

see above

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

docker run -d \
  --name=qbittorrent \
  --network=container:wireguard \
  -e PUID=1000 \
  -e PGID=1000 \
  -e UMASK=002 \
  -e TZ=America/Los_Angeles \
  -e WEBUI_PORT=8080 \
  -e QBITTORRENT_SERVER=10.2.0.2 \
  -e QBITTORRENT_PORT=8080 \
  -e QBITTORRENT_USER=<user> \
  -e QBITTORRENT_PASS=<pass> \
  -e VPN_GATEWAY=10.2.0.1 \
  -e VPN_IF_NAME=wg0 \
  -e CHECK_INTERVAL=45 \
  -e NAT_LEASE_LIFETIME=120 \
  -v /dockers/qbittorrent/config:/config \
  -v /dockers/qbittorrent/custom-services.d:/custom-services.d:ro \
  --restart unless-stopped \
  lscr.io/linuxserver/qbittorrent:latest

Container logs

the container logs say:

2024-08-26T21:28:22.837454559Z  2024-08-26 21:28:22 | QBITTORRENT_SERVER is empty or not set.
github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

Roxedus commented 2 months ago

Is that the whole script? You need the shebang. https://github.com/linuxserver/docker-qbittorrent/blob/master/root/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run#L1

moralrebuild commented 2 months ago

Thanks you for your great help! I didn't realize that it needs a special interpreter rather than a regular shell.

LinuxServer-CI commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 week ago

This issue is locked due to inactivity