Add configured event

Cloudron code paths like cron/mailer/taskmanager now wait for configuration
to be complete before doing anything.

This is useful when a cloudron is moved from a non-custom domain to a custom domain.
In that case, we require route53 configs.
This commit is contained in:
Girish Ramakrishnan
2015-11-03 15:50:02 -08:00
parent c075160e5d
commit b1dbb3570b
4 changed files with 55 additions and 26 deletions

View File

@@ -48,10 +48,10 @@ var gMailQueue = [ ],
function initialize(callback) {
assert.strictEqual(typeof callback, 'function');
if (cloudron.isActivatedSync()) {
if (cloudron.isConfiguredSync()) {
checkDns();
} else {
cloudron.events.on(cloudron.EVENT_ACTIVATED, checkDns);
cloudron.events.on(cloudron.EVENT_CONFIGURED, checkDns);
}
callback(null);
@@ -60,7 +60,7 @@ function initialize(callback) {
function uninitialize(callback) {
assert.strictEqual(typeof callback, 'function');
cloudron.events.removeListener(cloudron.EVENT_ACTIVATED, checkDns);
cloudron.events.removeListener(cloudron.EVENT_CONFIGURED, checkDns);
// TODO: interrupt processQueue as well
clearTimeout(gCheckDnsTimerId);