diff --git a/migrations/20180131152200-domains-add-tlsConfigJson.js b/migrations/20180131152200-domains-add-tlsConfigJson.js index f0b2cdf17..6621acd76 100644 --- a/migrations/20180131152200-domains-add-tlsConfigJson.js +++ b/migrations/20180131152200-domains-add-tlsConfigJson.js @@ -6,7 +6,7 @@ exports.up = function(db, callback) { db.all('SELECT * FROM settings WHERE name = ?', [ 'tls_config' ], function (error, result) { if (error) return callback(error); - var tlsConfigJson = (result[0] && result[0].value) ? result[0].value : JSON.stringify({ provider: 'letsencrypt-prod'}); + var tlsConfigJson = (result[0] && result[0].value) ? result[0].value : JSON.stringify({ provider: 'le-prod'}); async.series([ db.runSql.bind(db, 'START TRANSACTION;'), diff --git a/src/routes/domains.js b/src/routes/domains.js index f9a33c1ba..65af5d509 100644 --- a/src/routes/domains.js +++ b/src/routes/domains.js @@ -29,7 +29,7 @@ function add(req, res, next) { if ('tlsConfig' in req.body && typeof req.body.tlsConfig !== 'object') return next(new HttpError(400, 'tlsConfig must be a object with a provider string property')); if (req.body.tlsConfig && (!req.body.tlsConfig.provider || typeof req.body.tlsConfig.provider !== 'string')) return next(new HttpError(400, 'tlsConfig.provider must be a string')); - domains.add(req.body.domain, req.body.zoneName || '', req.body.provider, req.body.config, req.body.fallbackCertificate || null, req.body.tlsConfig || { provider: 'letsencrypt-prod' }, function (error) { + domains.add(req.body.domain, req.body.zoneName || '', req.body.provider, req.body.config, req.body.fallbackCertificate || null, req.body.tlsConfig || { provider: 'le-prod' }, function (error) { if (error && error.reason === DomainError.ALREADY_EXISTS) return next(new HttpError(409, error.message)); if (error && error.reason === DomainError.BAD_FIELD) return next(new HttpError(400, error.message)); if (error && error.reason === DomainError.INVALID_PROVIDER) return next(new HttpError(400, error.message)); @@ -72,7 +72,7 @@ function update(req, res, next) { if ('tlsConfig' in req.body && typeof req.body.tlsConfig !== 'object') return next(new HttpError(400, 'tlsConfig must be a object with a provider string property')); if (req.body.tlsConfig && (!req.body.tlsConfig.provider || typeof req.body.tlsConfig.provider !== 'string')) return next(new HttpError(400, 'tlsConfig.provider must be a string')); - domains.update(req.params.domain, req.body.provider, req.body.config, req.body.fallbackCertificate || null, req.body.tlsConfig || { provider: 'letsencrypt-prod' }, function (error) { + domains.update(req.params.domain, req.body.provider, req.body.config, req.body.fallbackCertificate || null, req.body.tlsConfig || { provider: 'le-prod' }, function (error) { if (error && error.reason === DomainError.NOT_FOUND) return next(new HttpError(404, error.message)); if (error && error.reason === DomainError.BAD_FIELD) return next(new HttpError(400, error.message)); if (error && error.reason === DomainError.INVALID_PROVIDER) return next(new HttpError(400, error.message)); diff --git a/src/routes/setup.js b/src/routes/setup.js index 51bfa5c48..ba052cb2f 100644 --- a/src/routes/setup.js +++ b/src/routes/setup.js @@ -75,7 +75,7 @@ function dnsSetup(req, res, next) { if ('tlsConfig' in req.body && typeof req.body.tlsConfig !== 'object') return next(new HttpError(400, 'tlsConfig must be an object')); if (req.body.tlsConfig && (!req.body.tlsConfig.provider || typeof req.body.tlsConfig.provider !== 'string')) return next(new HttpError(400, 'tlsConfig.provider must be a string')); - setup.dnsSetup(req.body.adminFqdn.toLowerCase(), req.body.domain.toLowerCase(), req.body.zoneName || '', req.body.provider, req.body.config, req.body.tlsConfig || { provider: 'letsencrypt-prod' }, function (error) { + setup.dnsSetup(req.body.adminFqdn.toLowerCase(), req.body.domain.toLowerCase(), req.body.zoneName || '', req.body.provider, req.body.config, req.body.tlsConfig || { provider: 'le-prod' }, function (error) { if (error && error.reason === SetupError.ALREADY_SETUP) return next(new HttpError(409, error.message)); if (error && error.reason === SetupError.BAD_FIELD) return next(new HttpError(400, error.message)); if (error) return next(new HttpError(500, error)); diff --git a/src/routes/test/domains-test.js b/src/routes/test/domains-test.js index c0137aa6c..2c1f9446d 100644 --- a/src/routes/test/domains-test.js +++ b/src/routes/test/domains-test.js @@ -22,13 +22,19 @@ var DOMAIN_0 = { domain: 'cloudron.com', zoneName: 'cloudron.com', provider: 'noop', - config: { } + config: { }, + tlsConfig: { + provider: 'fallback' + } }; var DOMAIN_1 = { domain: 'foobar.com', provider: 'noop', - config: { } + config: { }, + tlsConfig: { + provider: 'fallback' + } }; describe('Domains API', function () { diff --git a/src/test/apptask-test.js b/src/test/apptask-test.js index 0d847b8a3..2c61b7632 100644 --- a/src/test/apptask-test.js +++ b/src/test/apptask-test.js @@ -107,8 +107,7 @@ describe('apptask', function () { database._clear, domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0.zoneName, DOMAIN_0.provider, DOMAIN_0.config, null, DOMAIN_0.tlsConfig), appdb.add.bind(null, APP.id, APP.appStoreId, APP.manifest, APP.location, APP.domain, APP.portBindings, APP), - settings.initialize, - settings.setTlsConfig.bind(null, { provider: 'caas' }) + settings.initialize ], done); });