#!/usr/bin/with-contenv bash
# shellcheck shell=bash

#Check to make sure the subdomain and token are set
if [ -z "${SUBDOMAINS}" ] || [ -z "${TOKEN}" ]; then
    echo "Please pass both your subdomain(s) and token as environment variables in your docker run command. See the readme for more details."
    sleep infinity
fi

# permissions
lsiown -R abc:abc \
    /config

# run initial IP update
exec \
    s6-setuidgid abc /app/duck.sh
