2013-09-13 15:52:13 -05:00
|
|
|
define(['underscore'],
|
|
|
|
function (_) {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
return function Settings (options) {
|
|
|
|
/**
|
|
|
|
* To add a setting, you MUST define a default. Also,
|
|
|
|
* THESE ARE ONLY DEFAULTS.
|
|
|
|
* They are overridden by config.js in the root directory
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
var defaults = {
|
2013-12-06 13:32:38 -06:00
|
|
|
elasticsearch : "http://"+window.location.hostname+":9200",
|
2014-01-19 09:13:28 -06:00
|
|
|
graphiteUrl : "http://"+window.location.hostname+":8080",
|
2013-12-06 13:32:38 -06:00
|
|
|
panel_names : [],
|
2013-12-12 15:30:20 -06:00
|
|
|
default_route : '/dashboard/file/default.json',
|
2014-01-19 09:13:28 -06:00
|
|
|
grafana_index : 'grafana-dash'
|
2013-09-13 15:52:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// This initializes a new hash on purpose, to avoid adding parameters to
|
|
|
|
// config.js without providing sane defaults
|
|
|
|
var settings = {};
|
|
|
|
_.each(defaults, function(value, key) {
|
|
|
|
settings[key] = typeof options[key] !== 'undefined' ? options[key] : defaults[key];
|
|
|
|
});
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
};
|
|
|
|
});
|