#!/bin/sh

# Volumes
ODK_CONF="${VOLUMES_DIR}/opendatakit/odk_conf"
ODKBUILD_CONF="${VOLUMES_DIR}/opendatakit/odkbuild_conf"

# Replacements
sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}\"|" ${ODK_CONF}/server.xml
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${ODK_CONF}/server.xml
sed -i "s|\(^security\.server\.securePort=\).*|\1${PORT}|" ${ODK_CONF}/security.properties

cat <<EOF >${ODKBUILD_CONF}/add-ca-cert.env
HOST=${HOST}
PORT=${PORT}
EOF
