#!/bin/bash

. lib/common

set -e

DOMAIN=$(relation-get domain) || exit 1
URL="$(relation-get url)" || exit 1
PROTO="${URL%%://*}"

nextcloud:config:simple:add overwritehost "$DOMAIN" || {
    err "Failed to set ${WHITE}overwritehost${NORMAL} to '$DOMAIN'."
    exit 1
}

nextcloud:config:simple:add overwriteprotocol "$PROTO" || {
    err "Failed to set ${WHITE}overwriteprotocol${NORMAL} to '$PROTO'."
    exit 1
}