#!/usr/bin/env bash

# Configure shell.
set -m -u

# User-friendly print wrapper.
log() {
  printf '[%s] [%s] %s\n' "${0##*/}" "$( date '+%Y-%m-%dT%H:%M:%S' )" "${@}"
}

log "Creating an empty htpasswd file /etc/nginx/auth/${PROTECTED_SERVICE_NAME}"
touch "/etc/nginx/auth/${PROTECTED_SERVICE_NAME}"

log 'Launching password sync app in the background'
/usr/local/bin/sync-htpasswd.sh &
