heroku-gitea/parse_db_url.sh

28 lines
1.0 KiB
Bash
Raw Normal View History

2024-10-20 15:22:00 +02:00
#!/bin/sh
2024-10-23 12:54:51 +02:00
DATABASE_URL=$(echo $DATABASE_URL)
DB_TYPE="postgres"
USER=$(echo $DATABASE_URL | sed -e 's,.*//\(.*\):.*@.*,\1,')
PASSWD=$(echo $DATABASE_URL | sed -e 's,.*//.*:\(.*\)@.*,\1,')
HOST=$(echo $DATABASE_URL | sed -e 's,.*@\(.*\):\(.*\)/.*,\1,')
2024-10-23 13:05:11 +02:00
PORT_DB=$(echo $DATABASE_URL | sed -e 's,.*@.*:\(.*\)/.*,\1,')
2024-10-23 12:54:51 +02:00
NAME=$(echo $DATABASE_URL | sed -e 's,.*/\(.*\)$,\1,')
SSL_MODE="require"
2024-10-23 13:01:17 +02:00
printf "\n[server]\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 13:03:48 +02:00
printf "HTTP_PORT = $PORT\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 12:54:51 +02:00
2024-10-23 13:03:48 +02:00
printf "[database]\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 12:54:51 +02:00
printf "DB_TYPE = $DB_TYPE\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 13:05:11 +02:00
printf "HOST = $HOST:$PORT_DB\n" >> /var/lib/gitea/custom/conf/app.ini
2024-10-23 12:54:51 +02:00
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
2024-10-23 13:02:27 +02:00
cat /var/lib/gitea/custom/conf/app.ini
2024-10-23 12:29:23 +02:00
/usr/local/bin/gitea web -port $PORT