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

28 lines
699 B
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/')
cat > /data/gitea/conf/app.ini <<EOL
[database]
DB_TYPE = postgres
HOST = ${DB_HOST}
NAME = ${DB_NAME}
USER = ${DB_USER}
PASSWD = ${DB_PASSWORD}
SSL_MODE = require
[server]
DOMAIN = ${HEROKU_APP_DEFAULT_DOMAIN_NAME}
HTTP_PORT = ${PORT}
EOL
/usr/local/bin/gitea web --port $PORT