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.

20 lines
598 B

  1. #!/bin/bash
  2. ## When writing relation script, remember:
  3. ## - they should be idempotents
  4. ## - they can be launched while the dockers is already up
  5. ## - they are launched from the host
  6. ## - the target of the link is launched first, and get a chance to ``relation-set``
  7. ## - both side of the scripts get to use ``relation-get``.
  8. USER=$(relation-get user)
  9. PASSWORD="$(relation-get password 2>/dev/null)" || PASSWORD="$(gen_password)"
  10. config-add "\
  11. services:
  12. $TARGET_CHARM_NAME:
  13. environment:
  14. POSTGRES_USER: $USER
  15. POSTGRES_PASSWORD: $PASSWORD
  16. "
  17. relation-set password "$PASSWORD"