umts-microservices-engine 0.0.6 → 0.0.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7166a43b8566873abe89546e2c9bb0e3620bc53
|
4
|
+
data.tar.gz: ade4b9cf5322aa048a946c1e1aeedc35b2512822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83b037d3af5652428d19374ed0dab344b71b9dc13336bb18b09c32d48785f9c8c5041ba345ea66c6723c713dc851d1057a366c323de265209206927e535f054
|
7
|
+
data.tar.gz: 49c28abb01b77d05f0806d7bc7934ebf6b387bfa4373fb2219beedb02eee6fcf47cc203a56b86319d8afba83e3d186eb4030a51d225a05717408f6cd3a48b844
|
@@ -2,28 +2,27 @@
|
|
2
2
|
require 'net/http'
|
3
3
|
config_file = 'config/mse_router_info.yml'
|
4
4
|
|
5
|
+
REPORT_MISSING_CONFIG_KEY = -> (key) {
|
6
|
+
raise ArgumentError, "Missing key #{key} in config/initializers/mse_router_info.yml."
|
7
|
+
}
|
8
|
+
|
5
9
|
unless File.file?(config_file)
|
6
|
-
raise IOError, '
|
10
|
+
raise IOError, 'No router configuration YAML file found'
|
7
11
|
end
|
8
12
|
|
9
13
|
config_data = YAML.load_file(config_file)
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Make sure the URI ends with a / character
|
16
|
-
router_uri = config_data['router_uri']
|
17
|
-
|
18
|
-
uri = config_data['uri']
|
19
|
-
uri += '/' if uri[-1] != '/'
|
15
|
+
service_name = config_data.fetch :name, &REPORT_MISSING_CONFIG_KEY
|
16
|
+
service_url = config_data.fetch :uri, &REPORT_MISSING_CONFIG_KEY
|
17
|
+
router_url = config_data.fetch :router_uri, &REPORT_MISSING_CONFIG_KEY
|
18
|
+
security_token = config_data.fetch :security_token, &REPORT_MISSING_CONFIG_KEY
|
20
19
|
|
21
20
|
res = Net::HTTP.post_form(
|
22
|
-
URI(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
URI.parse(router_url),
|
22
|
+
name: service_name,
|
23
|
+
url: service_url,
|
24
|
+
models: config_data['accessible_models'],
|
25
|
+
security_token: security_token
|
27
26
|
)
|
28
27
|
|
29
|
-
raise '
|
28
|
+
raise 'The router API response was invalid' if res.code != '200'
|