diff --git a/domains/akshay.json b/domains/akshay.json index bd47657b1c..5d1e5acfcf 100644 --- a/domains/akshay.json +++ b/domains/akshay.json @@ -5,7 +5,6 @@ "username": "phenax", "email": "phenax5@gmail.com" }, - "forceHttps": true, "record": { "CNAME": "phenax.github.io" } diff --git a/domains/test.json b/domains/test.json index 94829c2181..19cb026d0a 100644 --- a/domains/test.json +++ b/domains/test.json @@ -4,7 +4,6 @@ "username": "phenax", "email": "phenax5@gmail.com" }, - "forceHttps": true, "record": { "CNAME": "duckduckgo.com" } diff --git a/scripts/register-domains.js b/scripts/register-domains.js index a8cc7979a4..06445f6c99 100644 --- a/scripts/register-domains.js +++ b/scripts/register-domains.js @@ -1,5 +1,5 @@ const R = require('ramda'); -const { VALID_RECORD_TYPES, NC_DOMAIN, TTL } = require('../utils/constants'); +const { VALID_RECORD_TYPES, TTL } = require('../utils/constants'); const { domainService: domain } = require('../utils/domain-service'); const { getDomains } = require('../utils/domain'); @@ -8,7 +8,7 @@ const getRecords = R.compose(R.toPairs, R.pick(VALID_RECORD_TYPES)); const toHostList = R.chain(data => { const rs = getRecords(data.record); - const records = R.chain(([recordType, urls]) => + return R.chain(([recordType, urls]) => (Array.isArray(urls) ? urls : [urls]).map(url => ({ HostName: data.name, RecordType: recordType, @@ -16,10 +16,6 @@ const toHostList = R.chain(data => { TTL, })) , rs); - - return !data.forceHttps ? records : records.concat([ - { HostName: data.name, RecordType: 'URL', Address: `https://${data.name}.${NC_DOMAIN}` }, - ]); }); const registerDomains = async ({ domainService, getDomains }) => { diff --git a/tests/domain-utils.test.js b/tests/domain-utils.test.js index 2420494edd..8dfbbacb81 100644 --- a/tests/domain-utils.test.js +++ b/tests/domain-utils.test.js @@ -9,7 +9,6 @@ describe('getDomains', () => { const defaultDomain = { name: 'aaa', - forceHttps: false, record: { A: ['121.121.121.121'] }, @@ -24,8 +23,6 @@ const getstroflen = len => Array(len).fill('a').join(''); describe('validateDomainData', () => { const invalidCases = [ {}, - { forceHttps: false }, - { forceHttps: 1 }, { name: 'helo' }, { name: 'wwow', record: { A: ['12312'] } }, ...['', ' ', undefined, 'hlo wld', 'g32++13', 'ajsdD_123yq', 'khsda%', '122*dsd', getstroflen(101)].map(name => ({ diff --git a/tests/register.test.js b/tests/register.test.js index 6c411a3d3e..1c7b78358e 100644 --- a/tests/register.test.js +++ b/tests/register.test.js @@ -1,12 +1,12 @@ const { toHostList } = require('../scripts/register-domains'); -const { NC_DOMAIN, TTL } = require('../utils/constants'); +const { TTL } = require('../utils/constants'); describe('toHostList', () => { it('should flatten domain data to list of hosts (without https)', () => { const res = toHostList([ - { name: 'akshay', forceHttps: false, record: { CNAME: 'phenax.github.io' } }, - { name: 'foobar', forceHttps: false, record: { CNAME: 'v.io' } }, - { name: 'xx', forceHttps: false, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } }, + { name: 'akshay', record: { CNAME: 'phenax.github.io' } }, + { name: 'foobar', record: { CNAME: 'v.io' } }, + { name: 'xx', record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } }, ]); expect(res).toEqual([ @@ -17,22 +17,4 @@ describe('toHostList', () => { { HostName: 'xx', RecordType: 'A', Address: '1.2.31.1', TTL }, ]); }); - - it('should flatten domain data to list of hosts (with https)', () => { - const res = toHostList([ - { name: 'akshay', forceHttps: true, record: { CNAME: 'phenax.github.io' } }, - { name: 'foobar', forceHttps: false, record: { CNAME: 'v.io' } }, - { name: 'xx', forceHttps: true, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } }, - ]); - - expect(res).toEqual([ - { HostName: 'akshay', RecordType: 'CNAME', Address: 'phenax.github.io', TTL }, - { HostName: 'akshay', RecordType: 'URL', Address: `https://akshay.${NC_DOMAIN}` }, - { HostName: 'foobar', RecordType: 'CNAME', Address: 'v.io', TTL }, - { HostName: 'xx', RecordType: 'A', Address: '1.2.3.4', TTL }, - { HostName: 'xx', RecordType: 'A', Address: '5.6.3.2', TTL }, - { HostName: 'xx', RecordType: 'A', Address: '1.2.31.1', TTL }, - { HostName: 'xx', RecordType: 'URL', Address: `https://xx.${NC_DOMAIN}` }, - ]); - }); }); diff --git a/utils/domain.js b/utils/domain.js index 19fa942a5a..5cbc48d6cf 100644 --- a/utils/domain.js +++ b/utils/domain.js @@ -52,10 +52,6 @@ const validateDomainData = validate({ }), ]), }, - forceHttps: { - reason: '`forceHttp` is required to be true or false', - fn: R.is(Boolean), - }, record: { reason: 'Invalid record', fn: R.allPass([