28 lines
491 B

  1. #!/bin/bash
  2. set -e
  3. . lib/common
  4. PASSWORD="$(relation-get password)"
  5. USER="$(relation-get user)"
  6. DBNAME="$(relation-get dbname)"
  7. control=$(echo -en "$USER\0$DBNAME\0$PASSWORD" | md5_compat)
  8. cfg-merge "
  9. database:
  10. name: psycopg2
  11. args:
  12. user: $USER
  13. password: $PASSWORD
  14. database: $DBNAME
  15. host: $MASTER_TARGET_SERVICE_NAME
  16. port: 5432
  17. cp_min: 5
  18. cp_max: 10
  19. "
  20. relation-set control "$control"
  21. info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."