Commit e0a20add authored by John E. Vincent's avatar John E. Vincent

fixing examples with new paths

parent 6b73341b
......@@ -5,7 +5,7 @@ require 'em-http-request'
class HttpPostWatch < Noah::CustomWatcher
redis_host "redis://127.0.0.1:6379/0"
pattern "//noah/configuration/redis_server"
pattern "//noah/configurations/redis_server"
destination Proc.new {|x| ::EM::HttpRequest.new('http://localhost:4567/webhook', :connection_timeout => 2, :inactivity_timeout => 4).post :body => x}
run!
end
......@@ -9,7 +9,7 @@ set :noah_client_name, 'my_sinatra_app'
def get_config_from_noah(setting)
begin
c = open("#{settings.noah_server}/c/#{settings.noah_client_name}/#{setting}").read
c = open("#{settings.noah_server}/applications/#{settings.noah_client_name}/configurations/#{setting}").read
set setting.to_sym, c
end
end
......@@ -17,7 +17,7 @@ end
get_config_from_noah('redis_server')
def get_redis_version
Ohm.connect :url => settings.redis_server
Ohm.connect :url => settings.redis_server['body']
Ohm.redis.info["redis_version"]
end
......@@ -25,9 +25,10 @@ get "/" do
"Redis version: #{get_redis_version}"
end
put "/webhook" do
post "/webhook" do
data = JSON.parse(request.body.read)
settings.redis_server = data["body"]
settings.redis_server = data
puts data["body"]
resp = {:message => "reconfigured", :setting => data["name"], :body => data["body"]}.to_json
"#{resp}"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment