#!${dash-output:dash}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically

if [ ! -e $${nginx-configuration:ssl_crt} ]
then
  ${openssl-output:openssl} genrsa -out $${nginx-configuration:ssl_key} 2048
  ${openssl-output:openssl} req -new \
    -subj "/C=AA/ST=Denial/L=Nowhere/O=Dis/CN=$${nginx-configuration:ip}" \
    -key $${nginx-configuration:ssl_key} -out $${nginx-configuration:ssl_csr}
  ${openssl-output:openssl} x509 -req -days 365 \
    -in $${nginx-configuration:ssl_csr} \
    -signkey $${nginx-configuration:ssl_key} \
    -out $${nginx-configuration:ssl_crt}
fi

exec ${nginx-output:nginx} \
  -c $${nginx-configuration:output}