Progmasoft Git

progmaweb

The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.

Clonegit clone https://git.progmasoft.com/progmaweb

Run notify-policies through systemd-run

A shell that sources /etc/progmaweb/account.env cuts the connection string
at its first ';', so the documented command could not reach the database.
systemd-run reads the file as the service does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commit
a96d26f26ab429ed28ba1f3630de3d892f644084
Author
Leitwolf11 ·
Parents
b76f9ded956a

Files · Download .tar.gz

Changes

 ops/README.md | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ops/README.md b/ops/README.md
index 2f07f0d..79c3cb1 100644
--- a/ops/README.md
+++ b/ops/README.md
@@ -105,13 +105,18 @@ The policies promise to write to account holders before a new version takes effe
 effect (`apps/web/lib/policies.ts` and `PolicyAcceptance.CurrentVersion` name the newest); `/privacy` and `/security`
 show the version in effect and link the next one, and `/privacy/<version>` shows any published version. Once the new
 version is deployed, tell every account holder who accepted an earlier one, as the `progmaweb` user with the
-environment of the service:
+environment of the service. systemd reads `/etc/progmaweb/account.env` as the service does; a shell that sources it
+cuts the connection string at its first `;`.
 
 ```sh
-cd /srv/progmaweb/current/api
-set -a; . /etc/progmaweb/account.env; set +a
-runuser -u progmaweb --preserve-environment -- /usr/bin/dotnet Progmaweb.Api.dll accounts notify-policies --dry-run
-runuser -u progmaweb --preserve-environment -- /usr/bin/dotnet Progmaweb.Api.dll accounts notify-policies
+notify() {
+  systemd-run --quiet --wait --pipe --collect -p User=progmaweb -p Group=progmaweb \
+    -p WorkingDirectory=/srv/progmaweb/current/api -p EnvironmentFile=/etc/progmaweb/account.env \
+    -p Environment=ASPNETCORE_ENVIRONMENT=Production \
+    /usr/bin/dotnet /srv/progmaweb/current/api/Progmaweb.Api.dll accounts notify-policies "$@"
+}
+notify --dry-run
+notify
 ```
 
 The notice comes from `noreply@progmasoft.com` with replies to support, in the four languages. Each one sent is