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.

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."