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.
 
 

21 lines
598 B

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