divan/deploy/entrypoint.sh
Anas Rashid 6bbd650741 Diwan: make env config work, ur-PK locale, own-site links relative
- AddEnvironmentVariables() where appsettings.json is read directly
- JWT ValidIssuer follows RSecurityBackend:ApplicationName (was hard-coded Ganjoor)
- deploy/entrypoint.sh: copy settings RSecurityBackend reads only from appsettings.json
- Dockerfile: pin SDK 10.0.302 (newer Razor rejects some upstream views)
- lang=ur-PK; ganjoor.net own-site links -> relative; api.ganjoor.net -> APIRoot; search.xml
- DIWAN.md: first admin password is Test!123 (upstream doc is wrong)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 23:32:16 +02:00

17 lines
818 B
Bash
Executable File

#!/bin/sh
# Parts of the app (and the RSecurityBackend NuGet package) read appsettings.json directly and ignore env vars
# (connection string, JWT secret/issuer, first admin). Copy those env values into the deployed file before starting.
# Values must not contain double quotes.
set_key() { # set_key <json key> <value>: replace "key": "..." (keys below are unique in appsettings.json)
[ -n "$2" ] || return 0
esc=$(printf '%s' "$2" | sed 's/[\\&|]/\\&/g')
sed -i "s|\"$1\": \"[^\"]*\"|\"$1\": \"$esc\"|" appsettings.json
}
if [ -f appsettings.json ]; then
set_key DefaultConnection "$ConnectionStrings__DefaultConnection"
set_key Secret "$Security__Secret"
set_key ApplicationName "$RSecurityBackend__ApplicationName"
set_key FirstUserEmail "$RSecurityBackend__FirstUserEmail"
fi
exec dotnet "$APP_DLL"