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.
45 lines
1004 B
45 lines
1004 B
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
PEERTUBE_CONFIG_DIR=/etc/peertube
|
|
|
|
HOST_CONFIG_DIR=$SERVICE_CONFIGSTORE/$PEERTUBE_CONFIG_DIR
|
|
|
|
PASSWORD="$(relation-get password)"
|
|
USER="$(relation-get user)"
|
|
DBNAME="$(relation-get dbname)"
|
|
HOST="$(relation-get host)"
|
|
PORT="$(relation-get port)"
|
|
|
|
cat <<EOF >> "$HOST_CONFIG_DIR/local.yaml"
|
|
|
|
database:
|
|
hostname: '$HOST'
|
|
## We had to patch peertube to have a direct dbname (doh!)
|
|
name: '$DBNAME'
|
|
port: '$PORT'
|
|
username: '$USER'
|
|
password: '$PASSWORD'
|
|
|
|
EOF
|
|
|
|
## XXXvlab: needed only for psql access to check if database is ready
|
|
## before launching the app.
|
|
uid=$(docker_get_uid "$SERVICE_NAME" peertube) || exit 1
|
|
|
|
chown "$uid" "$SERVICE_CONFIGSTORE/root/.pgpass" || exit 1
|
|
|
|
config-add "
|
|
services:
|
|
$MASTER_BASE_SERVICE_NAME:
|
|
environment:
|
|
PGUSER: $USER
|
|
PGHOST: $HOST
|
|
PGPORT: $PORT
|
|
PGDATABASE: $DBNAME
|
|
volumes:
|
|
- $SERVICE_CONFIGSTORE/root/.pgpass:/var/lib/peertube/.pgpass
|
|
"
|
|
|
|
info "Configured $SERVICE_NAME code for $HOST:$PORT access."
|