make the DNS API a little clearer

This commit is contained in:
Joshua Tauberer
2014-09-21 13:37:30 +00:00
parent 05510f25a5
commit 1637153566
2 changed files with 11 additions and 9 deletions
+1 -2
View File
@@ -184,12 +184,11 @@ def dns_set_record(qname, rtype="A", value=None):
# Get the value from the URL, then the POST parameters, or if it is not set then
# use the remote IP address of the request --- makes dynamic DNS easy. To clear a
# value, '' must be explicitly passed.
print(request.environ)
if value is None:
value = request.form.get("value")
if value is None:
value = request.environ.get("HTTP_X_FORWARDED_FOR") # normally REMOTE_ADDR but we're behind nginx as a reverse proxy
if value == '':
if value == '' or value == '__delete__':
# request deletion
value = None
if set_custom_dns_record(qname, rtype, value, env):