Commit 30f10ebd authored by priit's avatar priit

Installi mitmesse serverisse

parent 636f519b
var config = require('../../../config');
var request = require('request');
var async = require('async');
var logger = require('log4js').getLogger('installService');
var InstallService = function() {
......@@ -10,20 +11,29 @@ var InstallService = function() {
var wrapper = config.wrapper;
var serviceConfig = self.getConfiguration();
serviceConfig.apiKey = config.integration.apiKey;
request.post({
url: config.integration.installUrl,
json: serviceConfig
}, function(error, response, body) {
if(error){
logger.error(config.integration.installUrl);
logger.error(self.getConfiguration());
logger.error(error);
return cb(error);
}
cb(null, true);
async.each(config.integration, function (serverConf, innerCb) {
logger.debug(serverConf);
serviceConfig.apiKey = serverConf.apiKey;
request.post({
url: serverConf.installUrl,
json: serviceConfig
}, function(error, response, body) {
if(error){
logger.error( serverConf.installUrl);
logger.error(self.getConfiguration());
logger.error(error);
return innerCb(error);
}
innerCb(null, true);
});
}, function (err) {
logger.debug('Installed');
cb(err, true)
});
};
......
......@@ -7,10 +7,16 @@ config.redis = {
config.serverUrl = 'http://dev.bitweb.ee';
config.integration = {
installUrl: 'http://dev.bitweb.ee:3000/api/v1/service/install',
apiKey: 'server-wrapper-api-key'
};
config.integration = [
{
installUrl: 'http://dev.bitweb.ee:3000/api/v1/service/install',
apiKey: 'server-wrapper-api-key'
},
{
installUrl: 'http://keeleliin.keeleressursid.ee:3000/api/v1/service/install',
apiKey: 'server-wrapper-api-key'
}
];
config.fs = {
storagePath: "/wrapper/files",
......
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