From 7986a824d6e9b7942bad6510260bb04c6b5fbcdf Mon Sep 17 00:00:00 2001 From: Aaron Suggs Date: Mon, 19 Mar 2012 11:14:49 -0400 Subject: [PATCH] Support HTTPS, basic auth in graphite URL. graphite_host becomes graphite_base_url. --- config/settings.yml.example | 3 ++- lib/metric.rb | 2 +- public/js/default.js | 2 +- public/js/default.min.js | 2 +- public/js/graph.js | 2 +- views/index.haml | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/settings.yml.example b/config/settings.yml.example index 0829d6e..4ce0def 100644 --- a/config/settings.yml.example +++ b/config/settings.yml.example @@ -1,5 +1,6 @@ --- -graphite_host: graphite01.pp.local +graphite_base_url: http://graphite01.pp.local +#graphite_base_url: https://user:pass@graphite01.pp.local redis_url: localhost:6379:1/graphiti tmp_dir: /tmp fonts: diff --git a/lib/metric.rb b/lib/metric.rb index bffe65f..ada8675 100644 --- a/lib/metric.rb +++ b/lib/metric.rb @@ -25,7 +25,7 @@ def self.find(match, max = 100) private def self.get_metrics_list(prefix = Graphiti.settings.metric_prefix) - url = "http://#{Graphiti.settings.graphite_host}/metrics/index.json" + url = "#{Graphiti.settings.graphite_base_url}/metrics/index.json" puts "Getting #{url}" response = Typhoeus::Request.get(url) if response.success? diff --git a/public/js/default.js b/public/js/default.js index 16f58be..ef941cb 100644 --- a/public/js/default.js +++ b/public/js/default.js @@ -12566,7 +12566,7 @@ Graphiti.Graph = function(targetsAndOptions){ } Graphiti.Graph.prototype = { - urlBase: (function() { return "http://" + Graphiti.graphite_host + "/render/?"; })(), + urlBase: (function() { return Graphiti.graphite_base_url + "/render/?"; })(), updateOptions: function(options) { $.extend(true, this.options, options || {}); diff --git a/public/js/default.min.js b/public/js/default.min.js index 024fc52..c42d50d 100644 --- a/public/js/default.min.js +++ b/public/js/default.min.js @@ -264,7 +264,7 @@ function(b,e){var f=b.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);return f?(f[ (256|Math.round(255*this.rgb[2])).toString(16).substr(1)};var r=this,x=this.pickerMode.toLowerCase()==="hvs"?1:0,I=false,e=jscolor.fetchElement(this.valueElement),l=jscolor.fetchElement(this.styleElement),n=false,y=false,H=1,w=2,F=4,J=8;jscolor.addEvent(h,"focus",function(){r.pickerOnfocus&&r.showPicker()});jscolor.addEvent(h,"blur",function(){I?I=false:window.setTimeout(function(){I||(e===h&&r.importColor(),r.pickerOnfocus&&r.hidePicker());I=false},0)});e&&(G=function(){r.fromString(e.value,H)}, jscolor.addEvent(e,"keyup",G),jscolor.addEvent(e,"input",G),jscolor.addEvent(e,"blur",B),e.setAttribute("autocomplete","off"));if(l)l.jscStyle={backgroundColor:l.style.backgroundColor,color:l.style.color};switch(x){case 0:jscolor.requireImage("hs.png");break;case 1:jscolor.requireImage("hv.png")}jscolor.requireImage("cross.gif");jscolor.requireImage("arrow.gif");this.importColor()}};jscolor.install();(function(h){h.extend(h.fn,{dimensions:function(){var f=h(this);return{width:f.width(),height:f.height()}}})})(jQuery); Graphiti=window.Graphiti||{};Graphiti.Graph=function(h){this.options={};this.targets=[];this.parsedTargets=[];var f={width:950,height:400,from:"-6hour",fontSize:"10",title:"",targets:[]};h.options?$.extend(true,this.options,f,h.options):$.extend(true,this.options,f);if(h.targets)for(var b=0,k=h.targets.length;b