From e1559940eed40096bce292f626bac482d27c55c9 Mon Sep 17 00:00:00 2001 From: ldep30 Date: Fri, 10 Jun 2016 16:06:33 +0200 Subject: Update rest_client.rb to support 'rest' parameter --- extra/rest_client.rb | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'extra') diff --git a/extra/rest_client.rb b/extra/rest_client.rb index a16bd42..5809457 100644 --- a/extra/rest_client.rb +++ b/extra/rest_client.rb @@ -2,8 +2,32 @@ module Oxidized class RestClient require 'net/http' require 'json' - HOST = 'localhost' - PORT = 8888 + require 'uri' + require 'asetus' + + class Config + Root = File.join ENV['HOME'], '.config', 'oxidized' + end + + CFGS = Asetus.new :name=>'oxidized', :load=>false, :key_to_s=>true + CFGS.default.rest = '127.0.0.1:8888' + + begin + CFGS.load + rescue => error + raise InvalidConfig, "Error loading config: #{error.message}" + ensure + CFG = CFGS.cfg + end + + restcfg = CFG.rest + if ! restcfg.match(/^http:\/\//) + restcfg.insert(0, 'http://') + end + + HOST = URI(restcfg).host + PORT = URI(restcfg).port + PATH = URI(restcfg).path class << self def next opt={}, host=HOST, port=PORT @@ -18,7 +42,7 @@ module Oxidized def next opt data = JSON.dump opt - @web.put '/node/next/' + opt[:name].to_s, data + @web.put PATH + '/node/next/' + opt[:name].to_s, data end end -- cgit v1.2.1 From 47d2026800eb6f724626638609aa8cdaa05998b9 Mon Sep 17 00:00:00 2001 From: ldep30 Date: Wed, 15 Jun 2016 19:28:47 +0200 Subject: Update rest_client.rb --- extra/rest_client.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extra') diff --git a/extra/rest_client.rb b/extra/rest_client.rb index 5809457..90a64e4 100644 --- a/extra/rest_client.rb +++ b/extra/rest_client.rb @@ -6,7 +6,7 @@ module Oxidized require 'asetus' class Config - Root = File.join ENV['HOME'], '.config', 'oxidized' + Root = Root = ENV['OXIDIZED_HOME'] || File.join(ENV['HOME'], '.config', 'oxidized') end CFGS = Asetus.new :name=>'oxidized', :load=>false, :key_to_s=>true @@ -21,7 +21,7 @@ module Oxidized end restcfg = CFG.rest - if ! restcfg.match(/^http:\/\//) + unless restcfg.match(/^http:\/\//) restcfg.insert(0, 'http://') end -- cgit v1.2.1 From b5011707b9193ec4ecd4c4ee8df903b7becc1a6b Mon Sep 17 00:00:00 2001 From: ldep30 Date: Wed, 15 Jun 2016 20:21:51 +0200 Subject: Update rest_client.rb --- extra/rest_client.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'extra') diff --git a/extra/rest_client.rb b/extra/rest_client.rb index 90a64e4..35d93ae 100644 --- a/extra/rest_client.rb +++ b/extra/rest_client.rb @@ -16,11 +16,9 @@ module Oxidized CFGS.load rescue => error raise InvalidConfig, "Error loading config: #{error.message}" - ensure - CFG = CFGS.cfg end - restcfg = CFG.rest + restcfg = CFGS.cfg.rest unless restcfg.match(/^http:\/\//) restcfg.insert(0, 'http://') end -- cgit v1.2.1 From 90107fdced86e28fc6356e16ffb3bfa770d3a7b3 Mon Sep 17 00:00:00 2001 From: roedie Date: Wed, 12 Oct 2016 21:53:33 +0200 Subject: Add nginx reverse proxy example --- extra/oxidized.nginx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 extra/oxidized.nginx (limited to 'extra') diff --git a/extra/oxidized.nginx b/extra/oxidized.nginx new file mode 100644 index 0000000..06a4768 --- /dev/null +++ b/extra/oxidized.nginx @@ -0,0 +1,14 @@ +server { + listen 80; + listen [::]:80; + + server_name oxidized.example.com; + + location / { + proxy_pass http://127.0.0.1:8888/; + } + + access_log /var/log/nginx/access_oxidized.log; + error_log /var/log/nginx/error_oxidized.log; +} + -- cgit v1.2.1 From 8047a4dfb7c9a3f70e35c53b1d7703833da9d36a Mon Sep 17 00:00:00 2001 From: Denver Abrey Date: Thu, 13 Oct 2016 15:08:42 +0200 Subject: Add apache2 reverse proxy example --- extra/oxidized.apache2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 extra/oxidized.apache2 (limited to 'extra') diff --git a/extra/oxidized.apache2 b/extra/oxidized.apache2 new file mode 100644 index 0000000..0ab372b --- /dev/null +++ b/extra/oxidized.apache2 @@ -0,0 +1,14 @@ + + # Place in sites-available + + ServerAdmin admin@example.com + ServerName oxidized.example.com + ServerAlias oxidized + + ProxyPass / http://127.0.0.1:8888/ + ProxyPassReverse / http://127.0.0.1:8888/ + + ErrorLog /var/log/apache2/oxidized_error.log + CustomLog /var/log/apache2/oxidized_access.log combined + + -- cgit v1.2.1