caas: verify dns config

this is so that it fails if someone gives invalid token via API call
This commit is contained in:
Girish Ramakrishnan
2018-06-17 22:22:03 -07:00
parent 6ca28d9a58
commit 106e17f7ff
+15 -1
View File
@@ -133,5 +133,19 @@ function verifyDnsConfig(dnsConfig, domain, zoneName, ip, callback) {
fqdn: domain
};
return callback(null, credentials);
const testSubdomain = 'cloudrontestdns';
upsert(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error, changeId) {
if (error) return callback(error);
debug('verifyDnsConfig: Test A record added with change id %s', changeId);
del(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error) {
if (error) return callback(error);
debug('verifyDnsConfig: Test A record removed again');
callback(null, credentials);
});
});
}