Files
codex-bot 0c1ed2d292
studio CI and deployment / verify-and-deploy (push) Successful in 1m14s
wiki CI and deployment / verify-and-deploy (push) Failing after 25m6s
Add SSH-provisioned TOTP login with JWT sessions
2026-10-27 00:12:12 +08:00

18 lines
801 B
Bash

#!/usr/bin/env bash
set -Eeuo pipefail
IMAGE="${1:?Application image is required}"
# Preserve existing credentials and Docker project/volume names during migration.
if [ ! -f /etc/prompt.env ]; then
umask 077
TEMP_ENV=$(mktemp /etc/prompt.env.XXXXXX)
trap 'rm -f "$TEMP_ENV"' EXIT
docker run --rm --entrypoint node "$IMAGE" -e "const {randomBytes}=require('crypto');const hex=()=>randomBytes(32).toString('hex');console.log('POSTGRES_PASSWORD='+hex()+'\nS3_ACCESS_KEY='+hex()+'\nS3_SECRET_KEY='+hex()+'\nS3_BUCKET=prompt')" > "$TEMP_ENV"
mv "$TEMP_ENV" /etc/prompt.env
trap - EXIT
fi
# Current public entry uses HTTP. Operators can set true here after enabling HTTPS.
if ! grep -q '^AUTH_COOKIE_SECURE=' /etc/prompt.env; then
printf '\nAUTH_COOKIE_SECURE=false\n' >> /etc/prompt.env
fi