Skip to content

Commit

Permalink
Implement PECBRIDGE_ADMIN_MAIL env var
Browse files Browse the repository at this point in the history
If PECBRIDGE_ADMIN_MAIL is added to the environment file, Pec Bridge
uses its value to expand the XML configuration file. The value must be
an email address, which Pec Bridge uses to send a copy of notification
messages.
  • Loading branch information
DavidePrincipi authored and Amygos committed Sep 23, 2024
1 parent 0b75214 commit 04659b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions imageroot/systemd/user/pecbridge.service
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 6 additions & 2 deletions webapp/usr/share/pecbridge/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 04659b9

Please sign in to comment.