chmura-zajecia-gitea-heroku/run.sh
2025-01-04 20:51:06 +01:00

26 lines
1.0 KiB
Bash

#!/bin/bash
echo $APP_URL
echo DATABASE_URL
echo $DATABASE_URL
export DB_HOST=$(heroku config:get DATABASE_URL | sed 's/.*\/\/\(.*\):\(.*\)\/.*/\1/')
export DB_USER=$(heroku config:get DATABASE_URL | sed 's/.*\/\/\(.*\):\(.*\)\/.*/\1/')
export DB_PASSWORD=$(heroku config:get DATABASE_URL | sed 's/.*:\/\/.*:\(.*\)@.*/\1/')
export DB_NAME=$(heroku config:get DATABASE_URL | sed 's/.*\/\(.*\)/\1/')
mkdir -p /var/lib/gitea/custom/conf
echo "[server]" > /var/lib/gitea/custom/conf/app.ini
echo "ROOT_URL = $APP_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 = $DB_HOST" >> /var/lib/gitea/custom/conf/app.ini
echo "NAME = $DB_NAME" >> /var/lib/gitea/custom/conf/app.ini
echo "USER = $DB_USER" >> /var/lib/gitea/custom/conf/app.ini
echo "PASSWD = $DB_PASS" >> /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