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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 715d1bf1052253129dbeb8261b4827e43c5c67c2
4
- data.tar.gz: 17e9b820fbe61c229d6a271b7edb6dd3d080c0a8
3
+ metadata.gz: 8898e664723da738bf3af53220963892b7e8b74f
4
+ data.tar.gz: 4e0c261a541c640fd44d35b5a60687480730d7e5
5
5
  SHA512:
6
- metadata.gz: 8a8c8c47742f5996a5329d447f3113d0e8822531ec3542b8cd461986377c299d678c117c5b6159f971ed0ebdf00105c2bb0c3992eee2ed77176a09d90015ed88
7
- data.tar.gz: 9833d75a12e5cfaa069fecaa926a287e3c03ef0fcc44f3c56a8e634d9173c99e939dc6a94dfc18cac2d3a93d299efed8f34d36fac5e894bb0fd91b63030b7dd6
6
+ metadata.gz: defd5442812bbaa01255998e3a2fa67016993ca4b469064abc86ab80a225189f15cdee5a5b65cabf749d3ca0479f956447990f644f6f9c17bdc5056a11617f3c
7
+ data.tar.gz: d0099bad4b25775dc143f00d6690da05c354eecc73177661a9a2d48b112dd1660eb8c8736602f47307895c65ed4f23612765ed27d9b9b4ad3cd2d65e28c44fda
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- odania (0.0.4)
4
+ odania (0.0.5)
5
5
  diplomat
6
6
 
7
7
  GEM
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.register_service(plugin_name, plugin_instance_name, plugin_config['ip'])
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
@@ -1,28 +1,25 @@
1
1
  module Odania
2
2
  class Service < Odania::Consul
3
- def register_service(plugin_name, plugin_instance_name, ip)
4
- puts "Registering service #{plugin_name} as instance #{plugin_instance_name}"
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
- private
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' => ['odania-static'],
19
- 'port' => 80,
15
+ 'tags' => tags,
16
+ 'port' => port,
20
17
  'token' => plugin_instance_name,
21
18
  'checks' => [
22
19
  {
23
20
  'id' => plugin_name,
24
- 'name' => 'HTTP on port 80',
25
- 'http' => "http://#{ip}:80/health",
21
+ 'name' => "HTTP on port #{port}",
22
+ 'http' => "http://#{ip}:#{port}/health",
26
23
  'interval' => '10s',
27
24
  'timeout' => '1s'
28
25
  }
@@ -1,3 +1,3 @@
1
1
  module Odania
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen