#!/bin/bash

set -e

PEERTUBE_CONFIG_DIR=/etc/peertube

HOST_CONFIG_DIR=$SERVICE_CONFIGSTORE/$PEERTUBE_CONFIG_DIR

domain=$(relation-get domain) || {
    err "Can't get domain value."
    exit 1
}
cat <<EOF >> "$HOST_CONFIG_DIR/local.yaml"

webserver:
  https: true
  hostname: '$domain'
  port: 443

EOF

info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."