2013-11-12 20:57:20 +01:00
|
|
|
/* jshint node:true */
|
|
|
|
'use strict';
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
var config = {
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2014-01-21 14:44:40 +01:00
|
|
|
kibanaCheckoutDir: './kibana/vendor/kibana',
|
2013-11-21 11:11:11 +01:00
|
|
|
kibanaRevision: 'master',
|
2014-01-22 16:54:27 +01:00
|
|
|
agentDir: 'agent',
|
2013-11-18 21:36:21 +01:00
|
|
|
buildDir: 'build',
|
2013-12-23 20:56:45 +01:00
|
|
|
packageDir: 'build/packages',
|
2014-01-04 01:29:23 +01:00
|
|
|
senseDir: './sense',
|
2013-11-18 21:36:21 +01:00
|
|
|
esPort: {
|
2013-12-23 20:56:45 +01:00
|
|
|
dev: '":'+ (grunt.option('es_port') || 9200) +'"',
|
2013-11-18 21:36:21 +01:00
|
|
|
dist: "(window.location.port !== '' ? ':'+window.location.port : '')"
|
|
|
|
},
|
2014-01-05 22:59:56 +01:00
|
|
|
statsReportUrl: {
|
|
|
|
dev: '"http://" + window.location.hostname + ":'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/report"',
|
2014-01-22 13:21:55 +01:00
|
|
|
dist: '"https://marvel-stats.elasticsearch.com/"'
|
2014-01-05 22:59:56 +01:00
|
|
|
},
|
2013-11-21 15:03:20 +01:00
|
|
|
kibanaPort: grunt.option('port') || 5601,
|
2014-01-26 21:52:27 +01:00
|
|
|
kibanaHost: grunt.option('host') ||'localhost'
|
2013-11-12 20:57:20 +01:00
|
|
|
};
|
|
|
|
|
2013-11-18 21:36:21 +01:00
|
|
|
// more detailed config
|
2013-11-20 13:59:43 +01:00
|
|
|
config['buildTempDir'] = config['buildDir'] + '/tmp'; // kibana and custom panels will be merged here
|
2014-01-22 10:54:24 +01:00
|
|
|
config['buildSiteDir'] = config['buildDir'] + '/_site';
|
2014-01-04 01:29:23 +01:00
|
|
|
config['buildSenseDir'] = config['buildSiteDir'] + '/sense'; // compressed minified sense site will be here
|
2014-01-22 10:54:24 +01:00
|
|
|
config['buildKibanaDir'] = config['buildSiteDir'] + '/kibana'; // compressed minified marvel's kibana site will be output here
|
2013-11-18 21:36:21 +01:00
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// Utility function to load plugin settings into the above config object
|
2013-11-18 21:36:21 +01:00
|
|
|
function loadConfig(config, path) {
|
|
|
|
require('glob').sync('*', {cwd: path}).forEach(function (option) {
|
|
|
|
var key = option.replace(/\.js$/, '');
|
2013-11-15 15:32:20 +01:00
|
|
|
// Merge duplicate plugin configs. It is your responsibility to avoid naming collisions
|
|
|
|
// in tasks
|
2013-11-15 05:26:20 +01:00
|
|
|
config[key] = config[key] || {};
|
2013-11-18 21:36:21 +01:00
|
|
|
grunt.util._.extend(config[key], require(path + option)(config, grunt));
|
2013-11-15 05:26:20 +01:00
|
|
|
});
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// load plugins
|
|
|
|
require('load-grunt-tasks')(grunt);
|
2013-11-12 20:57:20 +01:00
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// Load Marvel tasks. Identical task names will override kibana tasks
|
|
|
|
grunt.loadTasks('tasks');
|
2013-11-18 21:36:21 +01:00
|
|
|
loadConfig(config, './tasks/options/');
|
2013-11-15 22:35:13 +01:00
|
|
|
|
2013-11-12 20:57:20 +01:00
|
|
|
// pass the config to grunt
|
|
|
|
grunt.initConfig(config);
|
|
|
|
|
|
|
|
};
|