gitea_heroku/script.sh

22 lines
675 B
Bash
Raw Normal View History

2024-10-18 22:54:52 +02:00
#!/bin/bash
2024-10-23 18:37:55 +02:00
# Database type
2024-10-18 22:54:52 +02:00
DB_TYPE=postgres
2024-10-23 18:37:55 +02:00
# Extract database credentials from DATABASE_URL
2024-10-18 22:54:52 +02:00
if [[ $DATABASE_URL =~ ^postgres://([^:]*):([^@]*)@([^:]*):([0-9]+)/([^/]*)$ ]]; then
USER="${BASH_REMATCH[1]}"
PASSWD="${BASH_REMATCH[2]}"
HOST="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}"
NAME="${BASH_REMATCH[5]}"
else
2024-10-23 18:37:55 +02:00
echo "Invalid DATABASE_URL: $DATABASE_URL"
2024-10-18 22:54:52 +02:00
exit 1
fi
2024-10-23 18:37:55 +02:00
mkdir -p /var/lib/gitea/custom/conf
2024-10-18 22:54:52 +02:00
2024-10-23 18:37:55 +02:00
# printf "[server]\nDOMAIN = $DOMAIN\n" > /var/lib/gitea/custom/conf/app.ini
printf "[database]\nDB_TYPE = $DB_TYPE\nHOST = $HOST\nNAME = $NAME\nUSER = $USER\nPASSWD = $PASSWD\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 18:07:28 +02:00
/usr/local/bin/gitea web $PORT