mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 06:56:07 -06:00
Update loadConfig to allow duplicates
This commit is contained in:
parent
ec964a13b9
commit
07f1571563
15
Gruntfile.js
15
Gruntfile.js
@ -15,17 +15,20 @@ module.exports = function (grunt) {
|
||||
// load task definitions
|
||||
grunt.loadTasks('tasks');
|
||||
|
||||
// Utility function to load plugin configurations into an object
|
||||
function loadConfig(path) {
|
||||
var object = {};
|
||||
// Utility function to load plugin settings into config
|
||||
function loadConfig(config,path) {
|
||||
require('glob').sync('*', {cwd: path}).forEach(function(option) {
|
||||
object[option.replace(/\.js$/,'')] = require(path + option)(config);
|
||||
var key = option.replace(/\.js$/,'');
|
||||
// If key already exists, extend it. It is your responsibility to avoid naming collisions
|
||||
config[key] = config[key] || {};
|
||||
grunt.util._.extend(config[key], require(path + option)(config));
|
||||
});
|
||||
return object;
|
||||
// technically not required
|
||||
return config;
|
||||
}
|
||||
|
||||
// Merge that object with what with whatever we have here
|
||||
grunt.util._.extend(config, loadConfig('./tasks/options/'));
|
||||
loadConfig(config,'./tasks/options/');
|
||||
|
||||
// pass the config to grunt
|
||||
grunt.initConfig(config);
|
||||
|
Loading…
Reference in New Issue
Block a user