#!/bin/bash FILE=./app_url.txt ROOT_URL=$(cat $FILE) printf($ROOT_URL) HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-` NAME=`echo $DATABASE_URL | grep -o "/[[:alnum:]]*$" | cut -c 2-` USER=`echo $DATABASE_URL | grep -o "//[[:alnum:]]*:" | grep -o "[[:alnum:]]*"` PASSWD=`echo $DATABASE_URL | grep -o ":[[:alnum:]]*@" | grep -o "[[:alnum:]]*"` mkdir -p /var/lib/gitea/custom/conf echo "[server]" > /var/lib/gitea/custom/conf/app.ini echo "ROOT_URL = $ROOT_URL >> /var/lib/gitea/custom/conf/app.ini echo "[database]" >> /var/lib/gitea/custom/conf/app.ini echo "DB_TYPE = postgres" >> /var/lib/gitea/custom/conf/app.ini echo "HOST = $HOST" >> /var/lib/gitea/custom/conf/app.ini echo "NAME = $NAME" >> /var/lib/gitea/custom/conf/app.ini echo "USER = $USER" >> /var/lib/gitea/custom/conf/app.ini echo "PASSWD = $PASSWD" >> /var/lib/gitea/custom/conf/app.ini echo "SSL_MODE = require" >> /var/lib/gitea/custom/conf/app.ini /usr/local/bin/gitea web --port $PORT