diff --git a/cloudron.js b/cloudron.js index 5d2ac31..7b212e4 100644 --- a/cloudron.js +++ b/cloudron.js @@ -444,12 +444,13 @@ Cloudron.prototype.setAutoupdatePattern = function (pattern) { }; Cloudron.prototype.checkA = function (callback) { - var that = this; + var expectedIp = this._.isCustomDomain ? this._.staticIp : this._.ip; + dns.resolve4(this._box.domain, function (error, records) { if (error) return callback(error); if (records.length !== 1) return callback(new Error('Got ' + JSON.stringify(records) + ' A records. Expecting 1 length array')); - if (records[0] !== that._box.staticIp) return callback(new Error('Bad A record. ' + records[0] + '. Expecting ' + that._box.staticIp)); + if (records[0] !== expectedIp) return callback(new Error('Bad A record. ' + records[0] + '. Expecting ' + expectedIp)); callback(null, records); }); diff --git a/test/cloudron-backup-test.js b/test/cloudron-backup-test.js index a32708c..a9cdf3f 100644 --- a/test/cloudron-backup-test.js +++ b/test/cloudron-backup-test.js @@ -153,9 +153,11 @@ describe('Cloudron backup testing', function () { }); it('wait for local dns', function () { + var expectedIp = box.isCustomDomain ? box.staticIp : box.ip; + for (var i = 0; i < 50; i++) { var ip = dnsSync.resolve(box.domain); - if (ip === box.staticIp) return; + if (ip === expectedIp) return; console.log('waiting for local dns to change from %s to %s', ip, box.staticIp); sleep(30);