You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
PASSWORD="$(relation-get password)"
|
|
DBUSER="$(relation-get user)"
|
|
DBNAME="$(relation-get dbname)"
|
|
HOST="$(relation-get host)"
|
|
PORT="$(relation-get port)"
|
|
|
|
. lib/common
|
|
|
|
|
|
control=$(p0 "$DBUSER" "$DBNAME" "$PASSWORD" "$HOST" "$PORT" | md5_compat)
|
|
|
|
## Note: we don't use environment variable as it will be ignored if
|
|
## $CONFIG_FILE is found. So better modify directly the config file.
|
|
# config-add "\
|
|
# services:
|
|
# $MASTER_BASE_SERVICE_NAME:
|
|
# environment:
|
|
# - DB_TYPE=postgres
|
|
# - DB_HOST=$HOST
|
|
# - DB_PORT=$PORT
|
|
# - DB_NAME=$DBNAME
|
|
# - DB_USER=$USER
|
|
# - DB_PASSWD=$PASSWORD
|
|
# "
|
|
|
|
# ini set database DB_TYPE postgres
|
|
# ini set database HOST postgres
|
|
# ini set database NAME gitea.mydomain.org
|
|
# ini set database USER gitea.mydomain.org
|
|
# ini set database PASSWD g61wsLvKj8cF6A1S
|
|
# ini set database SSL_MODE disable
|
|
|
|
ini merge <<EOF
|
|
[database]
|
|
DB_TYPE = postgres
|
|
HOST = $HOST:$PORT
|
|
NAME = $DBNAME
|
|
USER = $DBUSER
|
|
PASSWD = $PASSWORD
|
|
SSL_MODE = disable
|
|
EOF
|
|
|
|
|
|
relation-set control "$control"
|
|
|
|
info "Configured $SERVICE_NAME code for $HOST:$PORT access."
|