#!/bin/bash

set -e

. lib/common


server_name=$(options-get "server_name") || true
if [ -z "$server_name" ]; then
    DOMAIN=$(relation-get domain) || exit 1
    cfg-merge "server_name: $DOMAIN"
fi
URL=$(relation-get url) || exit 1
cfg-merge "public_baseurl: $URL"

sed -ri 's/^(\s+x_forwarded:\s+)[fF]alse/\1true/g' "$HOST_CONFIG_FILE"