Commit e8f99859 authored by priit's avatar priit

Teenuse install url-lt

parent f34d0281
......@@ -10,6 +10,16 @@ router.get('/config', function(req, res) {
return res.send(installService.getConfiguration());
});
router.get('/install', function(req, res) {
installService.install(function (err, success) {
if(err){
res.status(520);
res.send({errors: err});
return;
}
res.send({responses: success});
});
});
router.post('/', function ( req, res ) {
......
......@@ -12,6 +12,12 @@ var InstallService = function() {
var wrapper = config.wrapper;
var serviceConfig = self.getConfiguration();
if(!config.integration || config.integration.length == 0){
return cb('Servereid ei ole seadistatud');
}
var messages = [];
async.each(config.integration, function (serverConf, innerCb) {
logger.debug(serverConf);
......@@ -22,18 +28,23 @@ var InstallService = function() {
json: serviceConfig
}, function(error, response, body) {
if(error){
logger.error( serverConf.installUrl);
logger.error(self.getConfiguration());
logger.error( serverConf.installUrl );
logger.error( self.getConfiguration() );
logger.error(error);
return innerCb(error);
}
innerCb(null, true);
messages.push({
url: serverConf.installUrl,
response: body
});
innerCb(null);
});
}, function (err) {
logger.debug('Installed');
cb(err, true)
cb(err, messages)
});
};
......
......@@ -77,13 +77,6 @@ function startCluster( instanceCount, cb ){
cleanerService.init();
//Lase serveril üles ärgata
setTimeout(function(){
installService.install(function () {
log4jsLogger.trace('Instal callback');
})
}, ((Math.random() * 20000) + 5000 ));
} else {
startInstance(cb)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment