instructure_registrar 0.1.7 → 0.1.8

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: 93bb46a42ef28efae6f96f49430786c42e56f6fc
4
- data.tar.gz: 7d65d735315355fabd4137dc3302aab7178ed8cf
3
+ metadata.gz: a0e3c4c5ed5bb8cfc677bb3dca89cebf35e3d237
4
+ data.tar.gz: d6504ddc76c4cd021936ebf35362dee072bf80ee
5
5
  SHA512:
6
- metadata.gz: b19753ce19033dc22fc625f85b4be7293738905700eb385cdaaf0e04cde211cf74f9ee7cb4a8bbc03ca39c1bfbd7e02b26efa9f4006c9389c9d3721fb228703f
7
- data.tar.gz: 5788e2343af7d54a904203c531f97ec8734d744236ac8a66deb49c9c23112bb6e15173a9f5e103b3ec65f7af7509f453eeb957285361d0a7be0b592f12eff3a2
6
+ metadata.gz: cb1848b05a1a295c33f5512e0584d43566cd41eff4702fbb96ee8170e91c96cb645d991abd2dd394167188f42813baec0201a7a7bd350b1916da3d817b24cb06
7
+ data.tar.gz: c3fa8221b41e2aa416b602162f0d32c14cf300748d9b52c5e1f92a494c011222b3faf1a2a1e8d63e6fa68b528dbb0de8f2ca91f80ca604ae58c7f7c1d7a40ddf
data/README.md CHANGED
@@ -38,6 +38,7 @@ In your service's project folder, create a configuration file with the following
38
38
  config.service_name = "sample_service_3"
39
39
  config.service_host = ENV['SERVICE_HOST'] || "http://localhost"
40
40
  config.service_port = ENV['SERVICE_PORT'] || 3000
41
+ config.service_config = { token: 'foo', option: 'bar'}
41
42
  end
42
43
 
43
44
  if ENV['RAILS_ENV'] == "development"
@@ -6,8 +6,10 @@ InstructureRegistrar.configure do |config|
6
6
  config.registry_host = ENV.fetch('REGISTRY_HOST') || "http://instructure-etcd.docker"
7
7
  config.registry_port = ENV.fetch("REGISTRY_PORT") || 12379
8
8
  config.service_name = "my.service.name"
9
- config.service_host = "localhost"
10
- config.service_port = "3000"
9
+ confif.service_config = {
10
+ host: "localhost",
11
+ port: "3000"
12
+ }
11
13
  end
12
14
 
13
15
  InstructureRegistrar.register
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "dotenv"
22
21
  spec.add_dependency "etcd", "~> 0.3"
23
22
  spec.add_dependency "require_all"
24
23
 
@@ -27,16 +27,23 @@ module InstructureRegistrar
27
27
 
28
28
  def register
29
29
  return unless server_available
30
- client.set(
31
- "/#{InstructureRegistrar.config.service_name}",
32
- value: "#{InstructureRegistrar.config.service_host}:#{InstructureRegistrar.config.service_port}"
33
- )
30
+ InstructureRegistrar.config.service_config.keys.each do |key|
31
+ client.set(
32
+ "/#{InstructureRegistrar.config.service_name}/#{key}",
33
+ value: InstructureRegistrar.config.service_config[key]
34
+ )
35
+ end
34
36
  end
35
37
 
36
38
  def unregister
37
39
  return unless server_available
38
40
  begin
39
- client.delete("/#{InstructureRegistrar.config.service_name}")
41
+ InstructureRegistrar.config.service_config.keys.each do |key|
42
+ client.delete(
43
+ "/#{InstructureRegistrar.config.service_name}/#{key}",
44
+ value: InstructureRegistrar.config.service_config[key]
45
+ )
46
+ end
40
47
  rescue Etcd::KeyNotFound
41
48
  false
42
49
  end
@@ -1,3 +1,3 @@
1
1
  module InstructureRegistrar
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -30,7 +30,7 @@ module InstructureRegistrar
30
30
 
31
31
  class Configuration
32
32
  attr_accessor :registry_host, :registry_port
33
- attr_accessor :service_name, :service_host, :service_port
33
+ attr_accessor :service_name, :service_config
34
34
  end
35
35
 
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instructure_registrar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - CoralineAda
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-08-28 00:00:00.000000000 Z
12
+ date: 2015-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: dotenv
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: etcd
30
16
  requirement: !ruby/object:Gem::Requirement