Add option to modify host header template for camshaft batch client

This commit is contained in:
Raul Ochoa 2016-04-20 16:36:29 +02:00
parent 41ead9664b
commit a35403cd91
6 changed files with 18 additions and 6 deletions

View File

@ -202,7 +202,9 @@ var config = {
// - running an standalone server without any dependency on external services
inlineExecution: false,
// where the SQL API is running, it will use a custom Host header to specify the username.
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job'
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
}
}
,millstone: {

View File

@ -196,7 +196,9 @@ var config = {
// - running an standalone server without any dependency on external services
inlineExecution: false,
// where the SQL API is running, it will use a custom Host header to specify the username.
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job'
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
}
}
,millstone: {

View File

@ -196,7 +196,9 @@ var config = {
// - running an standalone server without any dependency on external services
inlineExecution: false,
// where the SQL API is running, it will use a custom Host header to specify the username.
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job'
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
}
}
,millstone: {

View File

@ -197,7 +197,9 @@ var config = {
// - running an standalone server without any dependency on external services
inlineExecution: true,
// where the SQL API is running, it will use a custom Host header to specify the username.
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job'
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
}
}
,millstone: {

View File

@ -4,6 +4,7 @@ function AnalysisBackend(options) {
var batchConfig = options.batch || {};
batchConfig.endpoint = batchConfig.endpoint || 'http://127.0.0.1:8080/api/v1/sql/job';
batchConfig.inlineExecution = batchConfig.inlineExecution || false;
batchConfig.hostHeaderTemplate = batchConfig.hostHeaderTemplate || '{{=it.username}}.localhost.lan';
this.batchConfig = batchConfig;
}
@ -12,6 +13,7 @@ module.exports = AnalysisBackend;
AnalysisBackend.prototype.create = function(analysisConfiguration, analysisDefinition, callback) {
analysisConfiguration.batch.endpoint = this.batchConfig.endpoint;
analysisConfiguration.batch.inlineExecution = this.batchConfig.inlineExecution;
analysisConfiguration.batch.hostHeaderTemplate = this.batchConfig.hostHeaderTemplate;
camshaft.create(analysisConfiguration, analysisDefinition, callback);
};

View File

@ -34,7 +34,8 @@ if (global.environment.statsd) {
var analysisConfig = _.defaults(global.environment.analysis || {}, {
batch: {
inlineExecution: false,
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job'
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
}
});
@ -92,7 +93,8 @@ module.exports = {
analysis: {
batch: {
inlineExecution: analysisConfig.batch.inlineExecution,
endpoint: analysisConfig.batch.endpoint
endpoint: analysisConfig.batch.endpoint,
hostHeaderTemplate: analysisConfig.batch.hostHeaderTemplate
}
},
// Do not send unwatch on release. See http://github.com/CartoDB/Windshaft-cartodb/issues/161