From e0b1b7fb1b1f3719dac26e820b8cd8ebb1dfc490 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 30 Sep 2019 22:18:08 +0200 Subject: [PATCH] fix: [mattermost] on first launch, there are no ``config.json``. --- mattermost/hooks/postgres_database-relation-joined | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mattermost/hooks/postgres_database-relation-joined b/mattermost/hooks/postgres_database-relation-joined index 5122349..7c0e0ef 100755 --- a/mattermost/hooks/postgres_database-relation-joined +++ b/mattermost/hooks/postgres_database-relation-joined @@ -18,8 +18,10 @@ services: MM_USERNAME: $USER " -sed -ri 's/(^\s+"DataSource": "postgres:[^:]+:)([^@]+)@/\1'"$PASSWORD"'@/' \ - "$SERVICE_CONFIGSTORE/mattermost/config/config.json" || exit 1 +if [ -e "$SERVICE_CONFIGSTORE/mattermost/config/config.json" ]; then + sed -ri 's/(^\s+"DataSource": "postgres:[^:]+:)([^@]+)@/\1'"$PASSWORD"'@/' \ + "$SERVICE_CONFIGSTORE/mattermost/config/config.json" || exit 1 +fi [ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0