upfluence-utils 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +30 -0
- data/lib/upfluence.rb +1 -0
- data/lib/upfluence/http/endpoint/api_endpoint.rb +18 -7
- data/lib/upfluence/http/middleware/prometheus.rb +19 -13
- data/lib/upfluence/http/server.rb +11 -8
- data/lib/upfluence/resources.rb +1 -0
- data/lib/upfluence/resources/countries.rb +23 -0
- data/lib/upfluence/utils/version.rb +1 -1
- data/rbutils.gemspec +4 -4
- metadata +31 -30
- data/lib/upfluence/base/exceptions/validation_error.rb +0 -35
- data/lib/upfluence/handler/base.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3bc57cd1a39618d9375c1e012443d9f5b700ab0f5ae821ccd634bc4d09a8c3f
|
4
|
+
data.tar.gz: ef52fa325dd39b37d053349e0adabea839cff25ad4cf1a3f24e56f8af79e3ca7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3148ad418210609e1fadd1303f0a37b6e27865e67b85102d4828891359fcaeb23b2481d0ad1cc6aa4c0a7967ead1c6aec77b56a6f42dc1b66bc5466a0a0bbc9d
|
7
|
+
data.tar.gz: 3da77ccc075193d01908f5070026ab5b6408b06267bb72c3554704d1f5559316d6b2316f432e6e54de928a155d66227ccca4aaf8b28ddd75ca49e7998b5c3342
|
@@ -0,0 +1,30 @@
|
|
1
|
+
### What does this PR do?
|
2
|
+
|
3
|
+
<!-- A brief description of the context of this pull request and its purpose. -->
|
4
|
+
|
5
|
+
Fixes #<!-- enter issue number here -->
|
6
|
+
|
7
|
+
### What are the observable changes?
|
8
|
+
<!-- This question could be adequate with multiple use cases, for example: -->
|
9
|
+
|
10
|
+
<!-- Frontend: explain the feature created / updated, give instructions telling how to see the change in staging -->
|
11
|
+
<!-- Performance: what metric should be impacted, link to the right graphana dashboard for exemple -->
|
12
|
+
<!-- Bug: a given issue trail on sentry should stop happening -->
|
13
|
+
<!-- Feature: Implements X thrift service / Z HTTP REST API added, provide instructions on how leverage your feature from staging or your workstation -->
|
14
|
+
|
15
|
+
### Good PR checklist
|
16
|
+
|
17
|
+
- [ ] Title makes sense
|
18
|
+
- [ ] Is against the correct branch
|
19
|
+
- [ ] Only addresses one issue
|
20
|
+
- [ ] Properly assigned
|
21
|
+
- [ ] Added/updated tests
|
22
|
+
- [ ] Added/updated documentation
|
23
|
+
- [ ] Properly labeled
|
24
|
+
|
25
|
+
### Additional Notes
|
26
|
+
|
27
|
+
<!--
|
28
|
+
You can add anything you want here, an explanation on the way you built your implementation,
|
29
|
+
precisions on the origin of the bug, gotchas you need to mention.
|
30
|
+
-->
|
data/lib/upfluence.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
require 'sinatra'
|
2
|
+
require 'active_record'
|
3
|
+
require 'active_support/hash_with_indifferent_access'
|
4
|
+
require 'upfluence/http/endpoint/validation_error'
|
2
5
|
|
3
6
|
module Upfluence
|
4
7
|
module HTTP
|
5
8
|
module Endpoint
|
6
9
|
class BadRequest < StandardError; end
|
7
10
|
class APIEndpoint < Sinatra::Base
|
11
|
+
VALIDATION_ERROR_KLASS = ValidationError
|
12
|
+
|
8
13
|
disable :show_exceptions
|
9
14
|
disable :logging
|
10
15
|
disable :dump_errors
|
@@ -31,9 +36,9 @@ module Upfluence
|
|
31
36
|
token = params[:access_token]
|
32
37
|
|
33
38
|
unless token
|
34
|
-
pattern
|
35
|
-
header
|
36
|
-
token
|
39
|
+
pattern = /^Bearer /
|
40
|
+
header = request.env['HTTP_AUTHORIZATION']
|
41
|
+
token = header.gsub(pattern, '') if header&.match(pattern)
|
37
42
|
end
|
38
43
|
|
39
44
|
token
|
@@ -42,7 +47,7 @@ module Upfluence
|
|
42
47
|
def respond_with(resource, *args)
|
43
48
|
if resource.respond_to?(:errors) && resource.errors.any?
|
44
49
|
status = 422
|
45
|
-
result =
|
50
|
+
result = VALIDATION_ERROR_KLASS.from_model(
|
46
51
|
resource
|
47
52
|
).to_json
|
48
53
|
else
|
@@ -50,13 +55,17 @@ module Upfluence
|
|
50
55
|
opts = args.first || {}
|
51
56
|
|
52
57
|
result = if resource.is_a? Enumerable
|
53
|
-
USerializer::ArraySerializer.new(
|
58
|
+
USerializer::ArraySerializer.new(
|
59
|
+
resource, *args
|
60
|
+
).to_json
|
54
61
|
elsif opts[:serializer]
|
55
62
|
opts[:serializer].new(resource, *args).to_json
|
56
63
|
elsif resource.respond_to?(:serialize)
|
57
64
|
resource.serialize(*args).to_json
|
58
65
|
else
|
59
|
-
USerializer.serializer_for(resource).new(
|
66
|
+
USerializer.serializer_for(resource).new(
|
67
|
+
resource, *args
|
68
|
+
).to_json
|
60
69
|
end
|
61
70
|
end
|
62
71
|
|
@@ -64,7 +73,9 @@ module Upfluence
|
|
64
73
|
end
|
65
74
|
|
66
75
|
def json_params
|
67
|
-
ActiveSupport::HashWithIndifferentAccess.new(
|
76
|
+
ActiveSupport::HashWithIndifferentAccess.new(
|
77
|
+
JSON.parse(request_body)
|
78
|
+
)
|
68
79
|
end
|
69
80
|
end
|
70
81
|
|
@@ -5,6 +5,8 @@ module Upfluence
|
|
5
5
|
module HTTP
|
6
6
|
module Middleware
|
7
7
|
class Prometheus
|
8
|
+
LABELS = %i[path method env].freeze
|
9
|
+
|
8
10
|
def initialize(app, registry = ::Prometheus::Client.registry)
|
9
11
|
@registry = registry
|
10
12
|
|
@@ -12,14 +14,16 @@ module Upfluence
|
|
12
14
|
:uhttp_handler_requests_total
|
13
15
|
) || @registry.counter(
|
14
16
|
:uhttp_handler_requests_total,
|
15
|
-
'Histogram of processed items',
|
17
|
+
docstring: 'Histogram of processed items',
|
18
|
+
labels: LABELS + %i[status]
|
16
19
|
)
|
17
20
|
|
18
21
|
@request_histogram = @registry.get(
|
19
22
|
:uhttp_handler_requests_duration_second
|
20
23
|
) || @registry.histogram(
|
21
24
|
:uhttp_handler_requests_duration_second,
|
22
|
-
'Histogram of processing time',
|
25
|
+
docstring: 'Histogram of processing time',
|
26
|
+
labels: LABELS
|
23
27
|
)
|
24
28
|
|
25
29
|
@app = app
|
@@ -41,19 +45,21 @@ module Upfluence
|
|
41
45
|
|
42
46
|
def record(env, code, duration)
|
43
47
|
@request_total_count.increment(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
+
labels: {
|
49
|
+
path: parse_route(env),
|
50
|
+
method: env['REQUEST_METHOD'].downcase,
|
51
|
+
status: code,
|
52
|
+
env: Upfluence.env.to_s
|
53
|
+
}
|
48
54
|
)
|
49
55
|
|
50
56
|
@request_histogram.observe(
|
51
|
-
|
52
|
-
|
57
|
+
duration,
|
58
|
+
labels: {
|
59
|
+
path: parse_route(env),
|
53
60
|
method: env['REQUEST_METHOD'].downcase,
|
54
|
-
env:
|
55
|
-
}
|
56
|
-
duration
|
61
|
+
env: Upfluence.env.to_s
|
62
|
+
}
|
57
63
|
)
|
58
64
|
end
|
59
65
|
|
@@ -75,8 +81,8 @@ module Upfluence
|
|
75
81
|
|
76
82
|
path = Rack::Request.new(env).path
|
77
83
|
|
78
|
-
splitted_template = route.split(' ').last.split('/').
|
79
|
-
v
|
84
|
+
splitted_template = route.split(' ').last.split('/').reject do |v|
|
85
|
+
v.eql?('')
|
80
86
|
end.reverse
|
81
87
|
|
82
88
|
path.split('/').reverse.map.with_index do |part, i|
|
@@ -14,7 +14,6 @@ require 'upfluence/http/middleware/application_headers'
|
|
14
14
|
require 'upfluence/http/middleware/handle_exception'
|
15
15
|
require 'upfluence/http/middleware/prometheus'
|
16
16
|
require 'upfluence/http/middleware/cors'
|
17
|
-
require 'upfluence/handler/base'
|
18
17
|
|
19
18
|
module Upfluence
|
20
19
|
module HTTP
|
@@ -29,13 +28,14 @@ module Upfluence
|
|
29
28
|
push_gateway_interval: 15, # sec
|
30
29
|
app_name: ENV['APP_NAME'] || 'uhttp-rb-server',
|
31
30
|
unit_name: ENV['UNIT_NAME'] || 'uhttp-rb-server-anonymous',
|
31
|
+
base_processor_klass: nil,
|
32
|
+
base_handler_klass: nil,
|
32
33
|
debug: ENV['DEBUG']
|
33
|
-
}
|
34
|
+
}
|
34
35
|
|
35
36
|
def initialize(options = {}, &block)
|
36
37
|
@options = DEFAULT_OPTIONS.dup.merge(options)
|
37
38
|
opts = @options
|
38
|
-
base_handler = Handler::Base.new(opts[:interfaces])
|
39
39
|
|
40
40
|
@builder = Builder.new do
|
41
41
|
use Middleware::Logger
|
@@ -54,13 +54,16 @@ module Upfluence
|
|
54
54
|
run(opts[:healthcheck_endpoint] || Endpoint::Healthcheck.new)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
if opts[:base_processor_klass] && opts[:base_handler_klass]
|
58
|
+
map '/base' do
|
59
|
+
run_thrift(
|
60
|
+
opts[:base_processor_klass],
|
61
|
+
opts[:base_handler_klass].new(@options[:interfaces])
|
62
|
+
)
|
63
|
+
end
|
59
64
|
end
|
60
65
|
|
61
|
-
map
|
62
|
-
run Endpoint::Profiler.new
|
63
|
-
end if opts[:debug]
|
66
|
+
map('/debug') { run(Endpoint::Profiler.new) } if opts[:debug]
|
64
67
|
|
65
68
|
instance_eval(&block)
|
66
69
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'upfluence/resources/countries'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Upfluence
|
2
|
+
module Resources
|
3
|
+
COUNTRIES = %w[
|
4
|
+
US FR GB DE CH AF AL DZ AS AD AO AI
|
5
|
+
AG AR AM AW AU AT AZ BS BH BD BB BY
|
6
|
+
BE BZ BJ BM BT BO BA BW BR BN BG BF
|
7
|
+
BI CV KH CM CA KY CF TD CL CN CO KM
|
8
|
+
CG CD CK CI HR CU CY CZ DK DJ DM DO
|
9
|
+
GW GY HT VA HN HK HU IS IN ID IR IQ
|
10
|
+
IE IM IL IT JM JP JE JO KZ KE KI KP
|
11
|
+
KR KW KG LA LV LB LI LS LR LY LT LU
|
12
|
+
MO MK MG MW MY MV ML MT MH MQ MR MU
|
13
|
+
MX FM MD MC MN ME MS MA MZ MM NA NR
|
14
|
+
NP NL NC NZ NI NE NG NO OM PK PW PS
|
15
|
+
PA PG PY PE PH PL PT PR QA RE RO RU
|
16
|
+
RW KN LC VC WS SM ST SA SN RS SC SL
|
17
|
+
SG SK SI SB SO ZA ES LK SD SR SZ SE
|
18
|
+
SY TW TJ TZ TH TL TG TO TT TN TR TM
|
19
|
+
TC TV UG UA AE GB UY UZ VU VE VN VG
|
20
|
+
VI EH YE ZM ZW CR
|
21
|
+
].freeze
|
22
|
+
end
|
23
|
+
end
|
data/rbutils.gemspec
CHANGED
@@ -17,10 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_development_dependency "bundler", "~> 1.12"
|
20
|
-
spec.add_development_dependency "rake", "
|
20
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
21
21
|
spec.add_development_dependency "rspec", "~> 3.0"
|
22
|
-
spec.add_runtime_dependency 'upfluence-thrift'
|
23
|
-
spec.add_runtime_dependency 'base-thrift', '>= 0.1.0'
|
22
|
+
spec.add_runtime_dependency 'upfluence-thrift'
|
24
23
|
spec.add_runtime_dependency 'sinatra'
|
25
24
|
spec.add_runtime_dependency 'redis'
|
26
25
|
spec.add_runtime_dependency 'sentry-raven'
|
@@ -29,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
29
28
|
spec.add_runtime_dependency 'puma'
|
30
29
|
spec.add_runtime_dependency 'rack'
|
31
30
|
spec.add_runtime_dependency 'stackprof'
|
32
|
-
spec.add_runtime_dependency 'prometheus-client', '~>
|
31
|
+
spec.add_runtime_dependency 'prometheus-client', '~> 2.1'
|
33
32
|
spec.add_runtime_dependency 'userializer'
|
33
|
+
spec.add_runtime_dependency 'activerecord'
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upfluence-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Upfluence
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,32 +54,18 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: upfluence-thrift
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.1'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.1'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: base-thrift
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
61
|
+
version: '0'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: sinatra
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +184,14 @@ dependencies:
|
|
198
184
|
requirements:
|
199
185
|
- - "~>"
|
200
186
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
187
|
+
version: '2.1'
|
202
188
|
type: :runtime
|
203
189
|
prerelease: false
|
204
190
|
version_requirements: !ruby/object:Gem::Requirement
|
205
191
|
requirements:
|
206
192
|
- - "~>"
|
207
193
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
194
|
+
version: '2.1'
|
209
195
|
- !ruby/object:Gem::Dependency
|
210
196
|
name: userializer
|
211
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,13 +206,28 @@ dependencies:
|
|
220
206
|
- - ">="
|
221
207
|
- !ruby/object:Gem::Version
|
222
208
|
version: '0'
|
223
|
-
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: activerecord
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
description:
|
224
224
|
email:
|
225
225
|
- dev@upfluence.com
|
226
226
|
executables: []
|
227
227
|
extensions: []
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
|
+
- ".github/pull_request_template.md"
|
230
231
|
- ".gitignore"
|
231
232
|
- ".rspec"
|
232
233
|
- ".travis.yml"
|
@@ -236,13 +237,11 @@ files:
|
|
236
237
|
- Rakefile
|
237
238
|
- lib/upfluence.rb
|
238
239
|
- lib/upfluence/amqp/server.rb
|
239
|
-
- lib/upfluence/base/exceptions/validation_error.rb
|
240
240
|
- lib/upfluence/endpoint/api_endpoint.rb
|
241
241
|
- lib/upfluence/environment.rb
|
242
242
|
- lib/upfluence/error_logger.rb
|
243
243
|
- lib/upfluence/error_logger/null.rb
|
244
244
|
- lib/upfluence/error_logger/sentry.rb
|
245
|
-
- lib/upfluence/handler/base.rb
|
246
245
|
- lib/upfluence/http/builder.rb
|
247
246
|
- lib/upfluence/http/endpoint/api_endpoint.rb
|
248
247
|
- lib/upfluence/http/endpoint/healthcheck.rb
|
@@ -258,6 +257,8 @@ files:
|
|
258
257
|
- lib/upfluence/mixin/strong_parameters.rb
|
259
258
|
- lib/upfluence/peer.rb
|
260
259
|
- lib/upfluence/pool.rb
|
260
|
+
- lib/upfluence/resources.rb
|
261
|
+
- lib/upfluence/resources/countries.rb
|
261
262
|
- lib/upfluence/utils.rb
|
262
263
|
- lib/upfluence/utils/http/middleware/null.rb
|
263
264
|
- lib/upfluence/utils/semaphore.rb
|
@@ -274,7 +275,7 @@ homepage: https://github.com/upfluence/rbutils
|
|
274
275
|
licenses:
|
275
276
|
- MIT
|
276
277
|
metadata: {}
|
277
|
-
post_install_message:
|
278
|
+
post_install_message:
|
278
279
|
rdoc_options: []
|
279
280
|
require_paths:
|
280
281
|
- lib
|
@@ -290,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
291
|
version: '0'
|
291
292
|
requirements: []
|
292
293
|
rubygems_version: 3.0.3
|
293
|
-
signing_key:
|
294
|
+
signing_key:
|
294
295
|
specification_version: 4
|
295
296
|
summary: Upfluence common utils for Ruby projects
|
296
297
|
test_files: []
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'thrift/exceptions'
|
2
|
-
require 'base/exceptions/exceptions_types'
|
3
|
-
|
4
|
-
module Base
|
5
|
-
module Exceptions
|
6
|
-
class ValidationError < ::Thrift::Exception
|
7
|
-
class << self
|
8
|
-
attr_accessor :domain
|
9
|
-
|
10
|
-
def from_model(model)
|
11
|
-
validation_errors = model.errors.details.map do |error_field, errors|
|
12
|
-
errors.map do |error|
|
13
|
-
Base::Exceptions::Validation.new(
|
14
|
-
domain: domain,
|
15
|
-
model: model.model_name.singular,
|
16
|
-
field: error_field.to_s,
|
17
|
-
error: error[:error].to_s
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end.flatten
|
21
|
-
|
22
|
-
new(validations: validation_errors)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_json
|
27
|
-
{
|
28
|
-
errors: validations.map do |v|
|
29
|
-
{ resource: v.model, field: v.field, code: v.error }
|
30
|
-
end
|
31
|
-
}.to_json
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'base/base_service/base_service'
|
2
|
-
require 'base/version/version_types'
|
3
|
-
require 'base/version'
|
4
|
-
|
5
|
-
module Upfluence
|
6
|
-
module Handler
|
7
|
-
class Base
|
8
|
-
def initialize(modules = [])
|
9
|
-
@alive_since = Time.now.to_i
|
10
|
-
@modules = modules.reduce({ 'base' => ::Base::VERSION }) do |acc, cur|
|
11
|
-
acc.merge cur.name.downcase => cur::VERSION
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def getVersion
|
16
|
-
semantic_version = if ENV['SEMVER_VERSION']
|
17
|
-
major, minor, patch = ENV['SEMVER_VERSION'].split('.')
|
18
|
-
::Base::Version::SemanticVersion.new(
|
19
|
-
major: major[1..-1].to_i,
|
20
|
-
minor: minor.to_i,
|
21
|
-
patch: patch.to_i
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
git_version = if ENV['GIT_COMMIT']
|
26
|
-
::Base::Version::GitVersion.new(
|
27
|
-
commit: ENV['GIT_COMMIT'],
|
28
|
-
branch: ENV['GIT_BRANCH'],
|
29
|
-
remote: ENV['GIT_REMOTE']
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
::Base::Version::Version.new(
|
34
|
-
semantic_version: semantic_version,
|
35
|
-
git_version: git_version
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def getName
|
40
|
-
ENV['UNIT_NAME'] || 'default'
|
41
|
-
end
|
42
|
-
|
43
|
-
def getStatus
|
44
|
-
::Base::Base_service::Status::ALIVE
|
45
|
-
end
|
46
|
-
|
47
|
-
def aliveSince
|
48
|
-
@alive_since
|
49
|
-
end
|
50
|
-
|
51
|
-
def getInterfaceVersions
|
52
|
-
@modules
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|