update route53 record of my.CUSTOM_DOMAIN
This commit is contained in:
parent
a78a6a9b0a
commit
3ba235ce9f
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
var AppStore = require('../appstore.js'),
|
var AppStore = require('../appstore.js'),
|
||||||
async = require('async'),
|
async = require('async'),
|
||||||
|
AWS = require('aws-sdk'),
|
||||||
Cloudron = require('../cloudron.js'),
|
Cloudron = require('../cloudron.js'),
|
||||||
common = require('../common.js'),
|
common = require('../common.js'),
|
||||||
dns = require('dns');
|
dns = require('dns');
|
||||||
@ -24,6 +25,7 @@ describe('Appstore new user flow', function () {
|
|||||||
this.timeout(0);
|
this.timeout(0);
|
||||||
|
|
||||||
var appStore = new AppStore('https://api.staging.cloudron.io');
|
var appStore = new AppStore('https://api.staging.cloudron.io');
|
||||||
|
var route53 = new AWS.Route53({ accessKeyId: process.env.AWS_STAGING_ACCESS_KEY, secretAccessKey: process.env.AWS_STAGING_SECRET_KEY });
|
||||||
|
|
||||||
var owner = common.getOwner();
|
var owner = common.getOwner();
|
||||||
var admin = common.getAdmin();
|
var admin = common.getAdmin();
|
||||||
@ -55,8 +57,34 @@ describe('Appstore new user flow', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can setup my. domain after it got IP', function () {
|
it('can setup my. domain after it got IP', function (done) {
|
||||||
var ip = appStore.waitForIP(box.id);
|
var ip = appStore.waitForIP(box.id);
|
||||||
|
|
||||||
|
// update the route53 record for my subdomain
|
||||||
|
route53.listHostedZonesByName({ DNSName: CUSTOM_DOMAIN, MaxItems: '1'}, function (error, result) {
|
||||||
|
if (error) return done(error);
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
ChangeBatch: {
|
||||||
|
Changes: [{
|
||||||
|
Action: 'UPSERT',
|
||||||
|
ResourceRecordSet: {
|
||||||
|
Type: 'A',
|
||||||
|
Name: 'my.' + CUSTOM_DOMAIN + '.',
|
||||||
|
ResourceRecords: [ { Value: ip } ],
|
||||||
|
TTL: 1
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
HostedZoneId: result.HostedZones[0].Id
|
||||||
|
};
|
||||||
|
|
||||||
|
route53.changeResourceRecordSets(params, function(error) {
|
||||||
|
if (error) return done(error);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can wait for cloudron', function () {
|
it('can wait for cloudron', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user