This commit is contained in:
awieczarek 2024-10-23 12:54:51 +02:00
parent b322b0e35c
commit 836df4270e

View File

@ -1,10 +1,28 @@
#!/bin/sh #!/bin/sh
export GITEA__database__DB_TYPE=postgres DATABASE_URL=$(echo $DATABASE_URL)
export GITEA__database__USER=$(echo ${DATABASE_URL} | sed -r "s|.*://([^:]+):.*|\1|")
export GITEA__database__PASSWD=$(echo ${DATABASE_URL} | sed -r "s|.*://[^:]+:([^@]+)@.*|\1|") DB_TYPE="postgres"
export GITEA__database__HOST=$(echo ${DATABASE_URL} | sed -r "s|.*@([^:]+):.*|\1|") USER=$(echo $DATABASE_URL | sed -e 's,.*//\(.*\):.*@.*,\1,')
export GITEA__database__NAME=$(echo ${DATABASE_URL} | sed -r "s|.*:([0-9]+)/([^?]+).*|\2|") PASSWD=$(echo $DATABASE_URL | sed -e 's,.*//.*:\(.*\)@.*,\1,')
printf "[database]\nDB_TYPE = postgres\n" > /var/lib/gitea/custom/conf/app.ini HOST=$(echo $DATABASE_URL | sed -e 's,.*@\(.*\):\(.*\)/.*,\1,')
PORT=$(echo $DATABASE_URL | sed -e 's,.*@.*:\(.*\)/.*,\1,')
NAME=$(echo $DATABASE_URL | sed -e 's,.*/\(.*\)$,\1,')
SSL_MODE="require"
mkdir -p /var/lib/gitea/custom/conf
printf "[database]\n" > /var/lib/gitea/custom/conf/app.ini
printf "DB_TYPE = $DB_TYPE\n" >> /var/lib/gitea/custom/conf/app.ini
printf "HOST = $HOST:$PORT\n" >> /var/lib/gitea/custom/conf/app.ini
printf "NAME = $NAME\n" >> /var/lib/gitea/custom/conf/app.ini
printf "USER = $USER\n" >> /var/lib/gitea/custom/conf/app.ini
printf "PASSWD = $PASSWD\n" >> /var/lib/gitea/custom/conf/app.ini
printf "SSL_MODE = $SSL_MODE\n" >> /var/lib/gitea/custom/conf/app.ini
printf "\n[server]\n" >> /var/lib/gitea/custom/conf/app.ini
printf "ROOT_URL = https://your-app-name.herokuapp.com/\n" >> /var/lib/gitea/custom/conf/app.ini
/usr/local/bin/gitea web -port $PORT /usr/local/bin/gitea web -port $PORT