diff --git a/src/config.js b/src/config.js index cba4c9abf..38b5e3fc1 100644 --- a/src/config.js +++ b/src/config.js @@ -79,7 +79,7 @@ function initConfig() { data.token = null; data.boxVersionsUrl = null; data.version = null; - data.isCustomDomain = false; + data.isCustomDomain = true; data.webServerOrigin = null; data.smtpPort = 2525; // // this value comes from mail container data.sysadminPort = 3001; diff --git a/src/routes/test/cloudron-test.js b/src/routes/test/cloudron-test.js index b7e70baa8..8e9b825a3 100644 --- a/src/routes/test/cloudron-test.js +++ b/src/routes/test/cloudron-test.js @@ -224,7 +224,7 @@ describe('Cloudron', function () { expect(result.body.apiServerOrigin).to.eql('http://localhost:6060'); expect(result.body.webServerOrigin).to.eql(null); expect(result.body.fqdn).to.eql(config.fqdn()); - expect(result.body.isCustomDomain).to.eql(false); + expect(result.body.isCustomDomain).to.eql(true); expect(result.body.progress).to.be.an('object'); expect(result.body.update).to.be.an('object'); expect(result.body.version).to.eql(config.version()); @@ -250,7 +250,7 @@ describe('Cloudron', function () { expect(result.body.apiServerOrigin).to.eql('http://localhost:6060'); expect(result.body.webServerOrigin).to.eql(null); expect(result.body.fqdn).to.eql(config.fqdn()); - expect(result.body.isCustomDomain).to.eql(false); + expect(result.body.isCustomDomain).to.eql(true); expect(result.body.progress).to.be.an('object'); expect(result.body.update).to.be.an('object'); expect(result.body.version).to.eql(config.version()); diff --git a/src/routes/test/settings-test.js b/src/routes/test/settings-test.js index aa658be2a..a468ce0d9 100644 --- a/src/routes/test/settings-test.js +++ b/src/routes/test/settings-test.js @@ -595,7 +595,7 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(spfDomain); expect(res.body.spf.type).to.eql('TXT'); expect(res.body.spf.value).to.eql(null); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); expect(res.body.spf.status).to.eql(false); done(); @@ -623,7 +623,7 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(config.fqdn()); expect(res.body.spf.type).to.eql('TXT'); expect(res.body.spf.value).to.eql(null); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); expect(res.body.spf.status).to.eql(false); done(); @@ -633,7 +633,7 @@ describe('Settings API', function () { it('succeeds with no dkim and existing spf', function (done) { clearDnsAnswerQueue(); - dnsAnswerQueue[spfDomain].TXT = [['v=spf1', 'a:my-foobar.com', '~all']]; + dnsAnswerQueue[spfDomain].TXT = [['v=spf1', 'a:' + config.adminFqdn(), '~all']]; superagent.get(SERVER_URL + '/api/v1/settings/email_dns_records') .query({ access_token: token }) @@ -650,8 +650,8 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(config.fqdn()); expect(res.body.spf.type).to.eql('TXT'); - expect(res.body.spf.value).to.eql('v=spf1 a:my-foobar.com ~all'); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com ~all'); + expect(res.body.spf.value).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); expect(res.body.spf.status).to.eql(true); done(); @@ -679,7 +679,7 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(config.fqdn()); expect(res.body.spf.type).to.eql('TXT'); expect(res.body.spf.value).to.eql('v=spf1 a:my-example.com ~all'); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com a:my-example.com ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' a:my-example.com ~all'); expect(res.body.spf.status).to.eql(false); done(); @@ -707,7 +707,7 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(config.fqdn()); expect(res.body.spf.type).to.eql('TXT'); expect(res.body.spf.value).to.eql(null); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); expect(res.body.spf.status).to.eql(false); done(); @@ -718,7 +718,7 @@ describe('Settings API', function () { clearDnsAnswerQueue(); dnsAnswerQueue[dkimDomain].TXT = [['v=DKIM1;', 't=s;', 'p=' + cloudron.readDkimPublicKeySync()]]; - dnsAnswerQueue[spfDomain].TXT = [['v=spf1', 'a:my-foobar.com', '~all']]; + dnsAnswerQueue[spfDomain].TXT = [['v=spf1', 'a:' + config.adminFqdn(), '~all']]; superagent.get(SERVER_URL + '/api/v1/settings/email_dns_records') .query({ access_token: token }) @@ -735,8 +735,8 @@ describe('Settings API', function () { expect(res.body.spf.domain).to.eql(config.fqdn()); expect(res.body.spf.type).to.eql('TXT'); - expect(res.body.spf.value).to.eql('v=spf1 a:my-foobar.com ~all'); - expect(res.body.spf.expected).to.eql('v=spf1 a:my-foobar.com ~all'); + expect(res.body.spf.value).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); + expect(res.body.spf.expected).to.eql('v=spf1 a:' + config.adminFqdn() + ' ~all'); expect(res.body.spf.status).to.eql(true); done(); diff --git a/src/test/apps-test.js b/src/test/apps-test.js index 3a71592ed..c70d5672d 100644 --- a/src/test/apps-test.js +++ b/src/test/apps-test.js @@ -206,7 +206,7 @@ describe('Apps', function () { expect(error).to.be(null); expect(app).to.be.ok(); expect(app.iconUrl).to.be(null); - expect(app.fqdn).to.eql(APP_0.location + '-' + config.fqdn()); + expect(app.fqdn).to.eql(APP_0.location + '.' + config.fqdn()); expect(app.memoryLimit).to.eql(0); done(); }); @@ -218,7 +218,7 @@ describe('Apps', function () { expect(apps).to.be.an(Array); expect(apps[0].id).to.be(APP_0.id); expect(apps[0].iconUrl).to.be(null); - expect(apps[0].fqdn).to.eql(APP_0.location + '-' + config.fqdn()); + expect(apps[0].fqdn).to.eql(APP_0.location + '.' + config.fqdn()); done(); }); }); diff --git a/src/test/apptask-test.js b/src/test/apptask-test.js index b00958d77..e58fc3858 100644 --- a/src/test/apptask-test.js +++ b/src/test/apptask-test.js @@ -1,4 +1,3 @@ -/* jslint node:true */ /* global it:false */ /* global describe:false */ /* global before:false */ @@ -64,24 +63,28 @@ var APP = { memoryLimit: 0 }; - var awsHostedZones = { - HostedZones: [{ - Id: '/hostedzone/ZONEID', - Name: 'localhost.', - CallerReference: '305AFD59-9D73-4502-B020-F4E6F889CB30', - ResourceRecordSetCount: 2, - ChangeInfo: { - Id: '/change/CKRTFJA0ANHXB', - Status: 'INSYNC' - } - }], - IsTruncated: false, - MaxItems: '100' - }; + var awsHostedZones; describe('apptask', function () { before(function (done) { config.set('version', '0.5.0'); + config.set('fqdn', 'foobar.com'); + + awsHostedZones = { + HostedZones: [{ + Id: '/hostedzone/ZONEID', + Name: config.fqdn() + '.', + CallerReference: '305AFD59-9D73-4502-B020-F4E6F889CB30', + ResourceRecordSetCount: 2, + ChangeInfo: { + Id: '/change/CKRTFJA0ANHXB', + Status: 'INSYNC' + } + }], + IsTruncated: false, + MaxItems: '100' + }; + async.series([ database.initialize, appdb.add.bind(null, APP.id, APP.appStoreId, APP.manifest, APP.location, APP.portBindings, APP), @@ -209,7 +212,7 @@ describe('apptask', function () { .get('/2013-04-01/hostedzone') .times(2) .reply(200, js2xml('ListHostedZonesResponse', awsHostedZones, { arrayMap: { HostedZones: 'HostedZone'} })) - .get('/2013-04-01/hostedzone/ZONEID/rrset?maxitems=1&name=applocation.localhost.&type=A') + .get('/2013-04-01/hostedzone/ZONEID/rrset?maxitems=1&name=applocation.' + config.fqdn() + '.&type=A') .reply(200, js2xml('ListResourceRecordSetsResponse', { ResourceRecordSets: [ ] }, { 'Content-Type': 'application/xml' })) .post('/2013-04-01/hostedzone/ZONEID/rrset/') .reply(200, js2xml('ChangeResourceRecordSetsResponse', { ChangeInfo: { Id: 'RRID', Status: 'INSYNC' } })); diff --git a/src/test/config-test.js b/src/test/config-test.js index b3b56e3af..8c4849e10 100644 --- a/src/test/config-test.js +++ b/src/test/config-test.js @@ -37,10 +37,10 @@ describe('config', function () { }); it('did set default values', function () { - expect(config.isCustomDomain()).to.equal(false); + expect(config.isCustomDomain()).to.equal(true); expect(config.fqdn()).to.equal('localhost'); - expect(config.adminOrigin()).to.equal('https://' + constants.ADMIN_LOCATION + '-localhost'); - expect(config.appFqdn('app')).to.equal('app-localhost'); + expect(config.adminOrigin()).to.equal('https://' + constants.ADMIN_LOCATION + '.localhost'); + expect(config.appFqdn('app')).to.equal('app.localhost'); expect(config.zoneName()).to.equal('localhost'); });