Add optional API key auth to the server
build / build (push) Successful in 3m4s

Deployments reachable outside a trusted LAN need some form of access
control. Set FUELISH_API_KEY and the server requires a matching
X-API-Key header on /jobs; unset, behavior is unchanged (no auth).
The Android app gets a matching Settings field. This only checks the
key - TLS termination is left to a reverse proxy in front of the
server, not handled here.
This commit is contained in:
ml
2026-10-04 11:41:55 +02:00
parent ca85530b5a
commit 7a91a37049
13 changed files with 111 additions and 25 deletions
+8 -1
View File
@@ -66,8 +66,15 @@ jobs:
set -euo pipefail
APK="$(ls dist/fuelish-*.apk)"
mkdir -p ~/.ssh
echo "${{ secrets.DL_SFTP_KEY }}" > ~/.ssh/dl_sftp_key
printf '%s\n' '${{ secrets.DL_SFTP_KEY }}' > ~/.ssh/dl_sftp_key
chmod 600 ~/.ssh/dl_sftp_key
# Sanity-check the key is actually loadable before attempting the
# SFTP connection - fails fast with a clear message instead of
# SFTP's much less obvious "Permission denied" when the key
# material itself is malformed (e.g. mangled by how the secret
# was entered into Gitea - see DL_SFTP_KEY in README.md).
ssh-keygen -y -f ~/.ssh/dl_sftp_key > /dev/null \
|| { echo "FAIL: ~/.ssh/dl_sftp_key is not a valid private key - re-check the DL_SFTP_KEY secret" >&2; exit 1; }
sftp -i ~/.ssh/dl_sftp_key -P 2223 \
-o StrictHostKeyChecking=accept-new \
uploader@dl.ladkau.de <<EOF