diff options
-rwxr-xr-x | update.sh | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash set -e # Not needed but useful to know @@ -8,12 +8,19 @@ function aws_ip_check { --query "ResourceRecordSets[?(Name == 'senders.io.' && Type == 'A')].ResourceRecords[0].Value | [0]" --output text } -if [ $# -ne 2 ]; then - echo "Usage: ./update.sh HOSTED_ZONE_ID DOMAIN" +if [ $# -lt 1 ]; then + echo "Usage: ./update.sh HOSTED_ZONE_ID DOMAIN + ./update.sh CONFIG_FILE +" + exit 1 +fi +if [ $# -eq 1 ]; then + source $1 +fi +if [ $# -eq 2 ]; then + HOSTED_ZONE_ID=$1 + DOMAIN=$2 fi -HOSTED_ZONE_ID=$1 -DOMAIN=$2 -source API_CONFIG RECORD_CHANGE_JSON=/tmp/aws-ip-update.json # Fetch IPs |