linuxserver/docker-wireguard

[BUG] Custom Server Port not taken into account in server.conf template

dsteinberg111 opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Using ENV: SERVERPORT does not change the Port of the Wireguard Interface

Expected Behavior

In server.conf the $SERVERPORT env should be taken instead of default 51820

Easy Fix:
templates/server.conf
change
ListenPort = 51820
to
ListenPort = ${SERVERPORT:-51820}

Steps To Reproduce

USE Serverport on Port != 51820

Environment

- OS: debian 12
- How docker service was installed: docker - compose

x-logging-std: &std_logging
  driver: journald

volumes:
  wireguard:

services:
  wireguard:
    image: lscr.io/linuxserver/wireguard:latest
    container_name: wireguard
    expose:
      - "51824"
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - SERVERPORT=51824
      - PEERS=list,of,users
      - PUID=1000
      - PGID=1000
      - TZ=${TZ:-Europe/Berlin}
      - LOG_CONFS=true
    volumes:
      - wireguard:/config
    ports:
      - 51824:51824/udp
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    restart: unless-stopped
    logging: *std_logging

CPU architecture

x86-64

Docker creation

not of relevance

Container logs

not of relevance

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

From readme:
-e SERVERURL=wireguard.domain.com External IP or domain name for docker host. Used in server mode. If set to auto, the container will try to determine and set the external IP automatically
-e SERVERPORT=51820 External port for docker host. Used in server mode.

okay, thank you - was a missunderstanding from my side.
Kind Regards

David