Make wildcard a separate provider

this is required because the config object is not returned for
locked domains and the UI display for the provider field is then
wrong.
This commit is contained in:
Girish Ramakrishnan
2018-09-06 19:58:46 -07:00
parent 44ed650538
commit 004f00a97b
3 changed files with 23 additions and 3 deletions
@@ -0,0 +1,21 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
db.all('SELECT * from domains WHERE provider=?', [ 'manual' ], function (error, results) {
if (error) return callback(error);
async.eachSeries(results, function (result, iteratorDone) {
var config = JSON.parse(result.configJson || '{}');
if (!config.wildcard) return iteratorDone();
delete config.wildcard;
db.runSql('UPDATE domains SET provider=?, configJson=? WHERE domain=?', [ 'wildcard', JSON.stringify(config), result.domain ], iteratorDone);
}, callback);
});
};
exports.down = function(db, callback) {
callback();
};