Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
e0a20add
Commit
e0a20add
authored
Oct 20, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing examples with new paths
parent
6b73341b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
reconfiguring-sinatra-watcher.rb
examples/reconfiguring-sinatra-watcher.rb
+1
-1
reconfiguring-sinatra.rb
examples/reconfiguring-sinatra.rb
+5
-4
No files found.
examples/reconfiguring-sinatra-watcher.rb
View file @
e0a20add
...
...
@@ -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/configuration
s
/redis_server"
destination
Proc
.
new
{
|
x
|
::
EM
::
HttpRequest
.
new
(
'http://localhost:4567/webhook'
,
:connection_timeout
=>
2
,
:inactivity_timeout
=>
4
).
post
:body
=>
x
}
run!
end
examples/reconfiguring-sinatra.rb
View file @
e0a20add
...
...
@@ -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
p
u
t
"/webhook"
do
p
os
t
"/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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment