odania 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/odania/plugin.rb +2 -1
- data/lib/odania/service.rb +7 -10
- data/lib/odania/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8898e664723da738bf3af53220963892b7e8b74f
|
4
|
+
data.tar.gz: 4e0c261a541c640fd44d35b5a60687480730d7e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: defd5442812bbaa01255998e3a2fa67016993ca4b469064abc86ab80a225189f15cdee5a5b65cabf749d3ca0479f956447990f644f6f9c17bdc5056a11617f3c
|
7
|
+
data.tar.gz: d0099bad4b25775dc143f00d6690da05c354eecc73177661a9a2d48b112dd1660eb8c8736602f47307895c65ed4f23612765ed27d9b9b4ad3cd2d65e28c44fda
|
data/Gemfile.lock
CHANGED
data/lib/odania/plugin.rb
CHANGED
@@ -25,7 +25,8 @@ module Odania
|
|
25
25
|
puts "Writing plugin instance config: #{plugin_instance_name}"
|
26
26
|
Diplomat::Kv.put("#{get_plugin_path(plugin_name)}#{plugin_instance_name}", JSON.dump(plugin_config))
|
27
27
|
|
28
|
-
Odania.service.
|
28
|
+
consul_config = Odania.service.consul_service_config(plugin_name, plugin_instance_name, plugin_config['ip'], plugin_config['tags'], plugin_config['port'])
|
29
|
+
Odania.service.register_service(consul_config)
|
29
30
|
|
30
31
|
Diplomat::Event.fire('updated_plugin_config', "#{plugin_name}|#{plugin_instance_name}")
|
31
32
|
end
|
data/lib/odania/service.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
module Odania
|
2
2
|
class Service < Odania::Consul
|
3
|
-
def register_service(
|
4
|
-
|
5
|
-
if Diplomat::Service.register consul_service_config(plugin_name, plugin_instance_name, ip)
|
3
|
+
def register_service(consul_config)
|
4
|
+
if Diplomat::Service.register consul_config
|
6
5
|
puts 'Service registered'
|
7
6
|
else
|
8
7
|
puts 'Error registering service'
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
def consul_service_config(plugin_name, plugin_instance_name, ip)
|
11
|
+
def consul_service_config(plugin_name, plugin_instance_name, ip, tags=[], port=80)
|
15
12
|
{
|
16
13
|
'id' => plugin_instance_name,
|
17
14
|
'name' => plugin_name,
|
18
|
-
'tags' =>
|
19
|
-
'port' =>
|
15
|
+
'tags' => tags,
|
16
|
+
'port' => port,
|
20
17
|
'token' => plugin_instance_name,
|
21
18
|
'checks' => [
|
22
19
|
{
|
23
20
|
'id' => plugin_name,
|
24
|
-
'name' =>
|
25
|
-
'http' => "http://#{ip}
|
21
|
+
'name' => "HTTP on port #{port}",
|
22
|
+
'http' => "http://#{ip}:#{port}/health",
|
26
23
|
'interval' => '10s',
|
27
24
|
'timeout' => '1s'
|
28
25
|
}
|
data/lib/odania/version.rb
CHANGED