forked from 0k/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.
29 lines
743 B
29 lines
743 B
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
PASSWORD="$(relation-get password)"
|
|
USER="$(relation-get user)"
|
|
DBNAME="$(relation-get dbname)"
|
|
HOST="$(relation-get host)"
|
|
PORT="$(relation-get port)"
|
|
|
|
control=$(p0 "$USER" "$DBNAME" "$PASSWORD" "$HOST" "$PORT" | md5_compat)
|
|
|
|
|
|
## Used doc from https://github.com/mattermost/docker/blob/main/env.example
|
|
config-add "\
|
|
services:
|
|
$MASTER_BASE_SERVICE_NAME:
|
|
environment:
|
|
MM_SQLSETTINGS_DRIVERNAME: postgres
|
|
MM_SQLSETTINGS_DATASOURCE: \"postgres://${USER}:${PASSWORD}@${HOST}:${PORT}/${DBNAME}?sslmode=disable&connect_timeout=10\"
|
|
" || exit 17
|
|
|
|
|
|
[ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0
|
|
|
|
|
|
relation-set control "$control"
|
|
|
|
info "Configured $SERVICE_NAME code for $HOST:$PORT access."
|