Merge pull request #2258 from lbschenkel/cloudflare-rec_id-for-15.05

ddns-scripts: allow setting CloudFlare 'rec_id' in the config
This commit is contained in:
Hannu Nyman 2016-01-11 12:56:58 +02:00
commit f6ee970394
2 changed files with 49 additions and 47 deletions

View file

@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
PKG_VERSION:=2.4.3 PKG_VERSION:=2.4.3
# Release == build # Release == build
# increase on changes of services files or tld_names.dat # increase on changes of services files or tld_names.dat
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com> PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>

View file

@ -57,6 +57,7 @@ cleanup() {
sed -i "#'##g" $DATFILE # remove "'" (single quote) sed -i "#'##g" $DATFILE # remove "'" (single quote)
} }
[ -n "$rec_id" ] && __RECID="$rec_id" || {
# build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html # build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html
# to "rec_load_all" to detect rec_id needed for update # to "rec_load_all" to detect rec_id needed for update
__URL="https://www.cloudflare.com/api_json.html" # https://www.cloudflare.com/api_json.html __URL="https://www.cloudflare.com/api_json.html" # https://www.cloudflare.com/api_json.html
@ -106,6 +107,7 @@ done
json_get_var __RECID "rec_id" # last thing to do get rec_id json_get_var __RECID "rec_id" # last thing to do get rec_id
json_cleanup # cleanup json_cleanup # cleanup
write_log 7 "rec_id '$__RECID' detected for host/domain '$domain'" write_log 7 "rec_id '$__RECID' detected for host/domain '$domain'"
}
# build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html # build url according to cloudflare client api at https://www.cloudflare.com/docs/client-api.html
# for "rec_edit" to update IP address # for "rec_edit" to update IP address