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 +4 -4
- data/README.md +10 -8
- data/lib/instructure_registrar/client.rb +3 -3
- data/lib/instructure_registrar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a33560eb329209c813a1b9774d0296e7f05b9fcc
|
4
|
+
data.tar.gz: b340f952c4ea4b0126d824e740445301c811e79a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
37
|
-
config.registry_port = ENV
|
38
|
-
config.service_name = "
|
39
|
-
config.service_host = ENV
|
40
|
-
config.service_port = ENV
|
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
|
-
|
44
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|