create maildb entry in database._clear
This commit is contained in:
@@ -8,6 +8,7 @@ exports = module.exports = {
|
||||
update: update,
|
||||
|
||||
_clear: clear,
|
||||
_addDefaultDomain: addDefaultDomain,
|
||||
|
||||
TYPE_USER: 'user',
|
||||
TYPE_APP: 'app',
|
||||
@@ -15,6 +16,7 @@ exports = module.exports = {
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
config = require('./config.js'),
|
||||
database = require('./database.js'),
|
||||
DatabaseError = require('./databaseerror.js'),
|
||||
safe = require('safetydance');
|
||||
@@ -120,3 +122,12 @@ function update(domain, data, callback) {
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
function addDefaultDomain(callback) {
|
||||
assert(config.fqdn(), 'no fqdn set in config, cannot continue');
|
||||
|
||||
add(config.fqdn(), function (error) {
|
||||
if (error && error.reason !== DatabaseError.ALREADY_EXISTS) return callback(error);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user