#!/bin/sh

set -eu

sitetype="$1"
sitesubd="$2"
sitezone="${sitesubd#*.}"
sitepref="${sitesubd%%.*}"

cfg_script="$0"
cfg_srcdir=$(cd -- "${cfg_script%/*}/" ; pwd -P)

sed -e 's/@sitesubd@/'"${sitesubd}"'/g'      \
	-e 's/@sitezone@/'"${sitezone}"'/g'  \
	-e 's/@sitepref@/'"${sitepref}"'/g'  \
	"${cfg_srcdir}/nginx.${sitetype}.conf.in"
