set appstore config to get updates

This commit is contained in:
Girish Ramakrishnan 2017-04-15 07:32:45 -07:00
parent 1f7a6fc322
commit d545ae7134
2 changed files with 12 additions and 0 deletions

View File

@ -799,3 +799,11 @@ Cloudron.prototype.checkNginxRateLimit = function (owner, times, callback) {
});
};
Cloudron.prototype.setAppstoreConfig = function (email, password, callback) {
superagent.post(process.env.APPSTORE_API_ORIGIN + '/api/v1/login').send({ email: email, password: password, persistent: true }).end(function (error, result) {
if (error || result.statusCode !== 200) return callback('Error logging into appstore:' + error.message);
superagent.post('https://' + that._adminFqdn + '/api/v1/settings/appstore_config').send({ userId: result.userId, token: result.accessToken }).end(callback);
});
};

View File

@ -238,6 +238,10 @@ describe('Selfhost DigitalOcean with filesystem backend', function () {
cloudron.checkAddons(cloudron.appFqdn(location), owner);
});
it('can set appstore config', function (done) {
cloudron.setAppstoreConfig(process.env.APPSTORE_USERNAME, process.env.APPSTORE_PASSWORD, done);
});
it('can update the box', function () {
cloudron.checkForUpdates();