1
0
Fork 0
mirror of https://git.tt-rss.org/fox/ttrss-docker-compose synced 2025-06-14 22:39:53 +02:00

set random password for admin when using default unless ADMIN_USER_PASS is set

This commit is contained in:
Andrew Dolgov 2022-06-10 22:48:27 +03:00
parent 5a41bb1850
commit c8b2b66402
No known key found for this signature in database
GPG key ID: 1A56B4FA25D4AF2A
3 changed files with 19 additions and 5 deletions

View file

@ -120,6 +120,17 @@ sudo -Eu app php8 $DST_DIR/update.php --update-schema=force-yes
if [ ! -z "$ADMIN_USER_PASS" ]; then
sudo -Eu app php8 $DST_DIR/update.php --user-set-password "admin:$ADMIN_USER_PASS"
else
if sudo -Eu app php8 $DST_DIR/update.php --user-check-password "admin:password"; then
RANDOM_PASS=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 16 ; echo '')
echo "*****************************************************************************"
echo "* Setting initial built-in admin user password to '$RANDOM_PASS' *"
echo "* If you want to set it manually, use ADMIN_USER_PASS environment variable. *"
echo "*****************************************************************************"
sudo -Eu app php8 $DST_DIR/update.php --user-set-password "admin:$RANDOM_PASS"
fi
fi
if [ ! -z "$ADMIN_USER_ACCESS_LEVEL" ]; then