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

  1. #!/bin/bash
  2. set -e
  3. PEERTUBE_CONFIG_DIR=/etc/peertube
  4. HOST_CONFIG_DIR=$SERVICE_CONFIGSTORE/$PEERTUBE_CONFIG_DIR
  5. PASSWORD="$(relation-get password)"
  6. USER="$(relation-get user)"
  7. DBNAME="$(relation-get dbname)"
  8. HOST="$(relation-get host)"
  9. PORT="$(relation-get port)"
  10. cat <<EOF >> "$HOST_CONFIG_DIR/local.yaml"
  11. database:
  12. hostname: '$HOST'
  13. ## We had to patch peertube to have a direct dbname (doh!)
  14. name: '$DBNAME'
  15. port: '$PORT'
  16. username: '$USER'
  17. password: '$PASSWORD'
  18. EOF
  19. ## XXXvlab: needed only for psql access to check if database is ready
  20. ## before launching the app.
  21. uid=$(docker_get_uid "$SERVICE_NAME" peertube) || exit 1
  22. chown "$uid" "$SERVICE_CONFIGSTORE/root/.pgpass" || exit 1
  23. config-add "
  24. services:
  25. $MASTER_BASE_SERVICE_NAME:
  26. environment:
  27. PGUSER: $USER
  28. PGHOST: $HOST
  29. PGPORT: $PORT
  30. PGDATABASE: $DBNAME
  31. volumes:
  32. - $SERVICE_CONFIGSTORE/root/.pgpass:/var/lib/peertube/.pgpass
  33. "
  34. info "Configured $SERVICE_NAME code for $HOST:$PORT access."