fork 0k-charms
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.

42 lines
964 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. cat <<EOF >> "$HOST_CONFIG_DIR/local.yaml"
  9. database:
  10. hostname: '$TARGET_SERVICE_NAME'
  11. ## We had to patch peertube to have a direct dbname (doh!)
  12. name: '$DBNAME'
  13. port: 5432
  14. username: '$USER'
  15. password: '$PASSWORD'
  16. EOF
  17. ## XXXvlab: needed only for psql access to check if database is ready
  18. ## before launching the app.
  19. uid=$(docker_get_uid "$SERVICE_NAME" peertube) || exit 1
  20. chown "$uid" "$SERVICE_CONFIGSTORE/root/.pgpass" || exit 1
  21. config-add "
  22. services:
  23. $MASTER_BASE_SERVICE_NAME:
  24. environment:
  25. PGUSER: $USER
  26. PGHOST: $TARGET_SERVICE_NAME
  27. PGDATABASE: $DBNAME
  28. volumes:
  29. - $SERVICE_CONFIGSTORE/root/.pgpass:/var/lib/peertube/.pgpass
  30. "
  31. info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."