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.

29 lines
647 B

  1. #!/bin/bash
  2. set -e
  3. PASSWORD="$(relation-get password)"
  4. USER="$(relation-get user)"
  5. DBNAME="$(relation-get dbname)"
  6. HOST="$(relation-get host)"
  7. PORT="$(relation-get port)"
  8. control=$(p0 "$USER" "$DBNAME" "$PASSWORD" "$ADMIN_PASSWORD" "$HOST" | md5_compat)
  9. config-add "\
  10. services:
  11. $MASTER_BASE_SERVICE_NAME:
  12. environment:
  13. DB_TYPE: postgres
  14. DB_HOST: \"$HOST\"
  15. DB_PORT: \"$PORT\"
  16. DB_NAME: \"$DBNAME\"
  17. DB_PASS: \"$PASSWORD\"
  18. DB_USER: \"$USER\"
  19. "
  20. [ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0
  21. relation-set control "$control"
  22. info "Configured $SERVICE_NAME code for $HOST:$PORT access."