#!/bin/sh mkdir -p /etc/nginx/htpasswd {{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} {{ $host := trim $host }} {{ $htpasswd := or (first (groupByKeys $containers "Env.VHOST_HTPASSWD")) "" }} if [ ! -z '{{$htpasswd}}' ] then echo '{{ $htpasswd }}' > /etc/nginx/htpasswd/{{ $host }} fi {{ end }} nginx -s reload