#!/bin/sh

set -eu

sitezone="$1"

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

source /root/config/private/config/server.ports
source /root/config/private/keys/pagure/pagure.keys
source /root/config/private/config/hostinfo/${sitezone}

sed -e 's/@ssh_port@/'${ssh_port}'/g' \
	-e 's/@pagure_flask_key@/'${pagure_flask_key}'/g' \
	-e 's/@pagure_pgsql_key@/'${pagure_pgsql_key}'/g' \
	-e 's/@pagure_email_key@/'${pagure_email_key}'/g' \
	-e 's/@sitename@/'${sitename}'/g'                 \
	-e 's/@sitezone@/'${sitezone}'/g'                 \
	-e 's/@sitemask@/'${sitemask}'/g'                 \
	-e 's/@smtphost@/'${smtphost}'/g'                 \
	-e 's/@docssite@/'${docssite}'/g'                 \
	-e 's/@docszone@/'${docszone}'/g'                 \
	-e 's/@devadmin@/'${devadmin}'/g'                 \
	-e 's/@vpn_ipv4@/'${vpn_ipv4}'/g'                 \
	"${cfg_srcdir}/pagure.cfg.in"

cat /root/config/private/config/pagure_ssh.pub
