diff --git a/imageroot/systemd/user/pecbridge.service b/imageroot/systemd/user/pecbridge.service index 4093028e..6d800779 100644 --- a/imageroot/systemd/user/pecbridge.service +++ b/imageroot/systemd/user/pecbridge.service @@ -18,6 +18,7 @@ ExecStart=/usr/bin/podman run \ --cgroups=no-conmon \ --replace --name=%N \ --env-file webapp.env \ + --env PECBRIDGE_ADMIN_MAIL \ --volume=./webtop.properties:/etc/webtop/webtop.properties:z \ --entrypoint=/usr/share/pecbridge/bin/run.sh \ ${WEBTOP_WEBAPP_IMAGE} diff --git a/webapp/usr/share/pecbridge/bin/run.sh b/webapp/usr/share/pecbridge/bin/run.sh index 527a8d4d..fc9e6df5 100755 --- a/webapp/usr/share/pecbridge/bin/run.sh +++ b/webapp/usr/share/pecbridge/bin/run.sh @@ -5,15 +5,19 @@ # SPDX-License-Identifier: GPL-3.0-or-later # +set -e + PBHOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" cd "$PBHOME" -CLASSPATH=lib/*:classes +CLASSPATH="lib/*:classes" export PATH CLASSPATH # Expand the Pecbridge configuration file template: -sed "s/WEBAPP_API_TOKEN/${WEBAPP_API_TOKEN:?}/" etc/config.xml.template > etc/config.xml +sed -e "s/WEBAPP_API_TOKEN/${WEBAPP_API_TOKEN:?}/" \ + ${PECBRIDGE_ADMIN_MAIL:+-e "1 s/sonicle-pec-bridge /sonicle-pec-bridge adminMail=\"${PECBRIDGE_ADMIN_MAIL}\" /"} \ + etc/config.xml.template > etc/config.xml # Start the Pecbridge process exec java com.sonicle.pecbridge.Main etc/config.xml