instructure_registrar 0.1.3 → 0.1.4

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: 8f8605c9788c22dde0600822e4878c52c8d5a38d
4
- data.tar.gz: 655adbbfd534556bbd17e22e30d2b76bd9d085af
3
+ metadata.gz: a33560eb329209c813a1b9774d0296e7f05b9fcc
4
+ data.tar.gz: b340f952c4ea4b0126d824e740445301c811e79a
5
5
  SHA512:
6
- metadata.gz: 2a1b47ef80d7e208cc7957f36b3ea5c1e04136a0bbc80843c1298c366a2701f5105dc07f202cac1a2cf79750cd35598a891d35f01da6c1ae0815b690a7e4e447
7
- data.tar.gz: 3b9f6b8e703d257009eb91390aff42f5cea76cdc034359d727d9ef5802048ffb1b9d0898f9da69800c46e035d5cf4d679f1af06610864c3ce02d50bfef3a18a0
6
+ metadata.gz: 07943ccc3417ecb53822afad883c21d123468374122a6b552a5cf3e7a6a407b2e8b8a673c68a7cc289deccc1fc216bce4a0276088ee062b9331f11507b5d8461
7
+ data.tar.gz: afdf84595760a2ac9824f66df168896b32f764f6c4db02f130f0b86bf664b3e43ed702d793c86933bfb93087c9798d4a773dd85b0732ed9168da75e1da863e57
data/README.md CHANGED
@@ -28,20 +28,22 @@ information for your local etcd instance:
28
28
  In your service's project folder, create a configuration file with the following contents:
29
29
 
30
30
  #/config/initializers/instructure_registrar.rb
31
+ require 'instructure_registrar'
31
32
  require 'dotenv'
32
33
  Dotenv.load
33
- require 'instructure_registrar'
34
34
 
35
35
  InstructureRegistrar.configure do |config|
36
- config.registry_host = ENV.fetch('REGISTRY_HOST') || "http://instructure-etcd.docker"
37
- config.registry_port = ENV.fetch("REGISTRY_PORT") || 12379
38
- config.service_name = "my.service.name"
39
- config.service_host = ENV.fetch("SERVICE_HOST") || "http://localhost/"
40
- config.service_port = ENV.fetch("SERVICE_PORT") || 3000
36
+ config.registry_host = ENV['REGISTRY_HOST']# || "http://instructure-etcd.docker"
37
+ config.registry_port = ENV['REGISTRY_PORT']# || 12379
38
+ config.service_name = "sample_service_3"
39
+ config.service_host = ENV['SERVICE_HOST'] || "http://localhost"
40
+ config.service_port = ENV['SERVICE_PORT'] || 3000
41
41
  end
42
42
 
43
- InstructureRegistrar.register
44
- at_exit { InstructureRegistrar.unregister }
43
+ if ENV['RAILS_ENV'] == "development"
44
+ InstructureRegistrar.register
45
+ at_exit { InstructureRegistrar.unregister }
46
+ end
45
47
 
46
48
  ### Looking up a service
47
49
 
@@ -4,18 +4,18 @@ module InstructureRegistrar
4
4
  require 'etcd'
5
5
 
6
6
  def lookup(service_name)
7
- client.get(service_name).value || "unknown"
7
+ client.get("/#{service_name}").value || "unknown"
8
8
  end
9
9
 
10
10
  def register
11
11
  client.set(
12
- InstructureRegistrar.config.service_name,
12
+ "/#{InstructureRegistrar.config.service_name}",
13
13
  value: "#{InstructureRegistrar.config.service_host}:#{InstructureRegistrar.config.service_port}"
14
14
  )
15
15
  end
16
16
 
17
17
  def unregister
18
- client.delete(InstructureRegistrar.config.service_name)
18
+ client.delete("/#{InstructureRegistrar.config.service_name}")
19
19
  end
20
20
 
21
21
  private
@@ -1,3 +1,3 @@
1
1
  module InstructureRegistrar
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instructure_registrar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - CoralineAda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv