gitea_heroku/script.sh

31 lines
926 B
Bash
Raw Normal View History

2024-10-18 22:54:52 +02:00
#!/bin/bash
DB_TYPE=postgres
DOMAIN="$APP_NAME.herokuapp.com"
echo $DATABASE_URL
echo $APP_NAME
# Wydobycie informacji z DATABASE_URL
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
echo "Nieprawidłowy format DATABASE_URL."
exit 1
fi
2024-10-23 18:07:28 +02:00
export GITEA__database__DB_TYPE=$DB_TYPE
export GITEA__database__HOST=$HOST
export GITEA__database__NAME=$NAME
export GITEA__database__USER=$USER
export GITEA__database__PASSWD=$PASSWD
2024-10-18 22:54:52 +02:00
2024-10-23 18:07:28 +02:00
# mkdir -p /var/lib/gitea/custom/conf
2024-10-18 22:54:52 +02:00
2024-10-23 18:07:28 +02:00
# printf "[server]\nHTTP_PORT = $PORT;\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
/usr/local/bin/gitea web $PORT