fluentd 1.18.0-x64-mingw-ucrt → 1.19.1-x64-mingw-ucrt
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/.rubocop.yml +116 -0
- data/CHANGELOG.md +270 -12
- data/MAINTAINERS.md +8 -2
- data/README.md +3 -7
- data/Rakefile +2 -0
- data/SECURITY.md +11 -3
- data/lib/fluent/command/cap_ctl.rb +2 -2
- data/lib/fluent/command/fluentd.rb +6 -2
- data/lib/fluent/compat/formatter.rb +6 -0
- data/lib/fluent/compat/socket_util.rb +2 -2
- data/lib/fluent/config/configure_proxy.rb +1 -1
- data/lib/fluent/config/element.rb +2 -2
- data/lib/fluent/config/literal_parser.rb +3 -3
- data/lib/fluent/config/parser.rb +15 -3
- data/lib/fluent/config/section.rb +2 -2
- data/lib/fluent/config/types.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +3 -3
- data/lib/fluent/config/yaml_parser/parser.rb +10 -2
- data/lib/fluent/counter/store.rb +1 -1
- data/lib/fluent/engine.rb +1 -1
- data/lib/fluent/env.rb +3 -2
- data/lib/fluent/event.rb +7 -6
- data/lib/fluent/log/console_adapter.rb +5 -7
- data/lib/fluent/log.rb +23 -0
- data/lib/fluent/plugin/bare_output.rb +0 -16
- data/lib/fluent/plugin/base.rb +2 -2
- data/lib/fluent/plugin/buf_file.rb +15 -1
- data/lib/fluent/plugin/buf_file_single.rb +15 -1
- data/lib/fluent/plugin/buffer/chunk.rb +74 -10
- data/lib/fluent/plugin/buffer/file_chunk.rb +9 -5
- data/lib/fluent/plugin/buffer/file_single_chunk.rb +3 -3
- data/lib/fluent/plugin/buffer/memory_chunk.rb +2 -2
- data/lib/fluent/plugin/buffer.rb +34 -6
- data/lib/fluent/plugin/compressable.rb +68 -22
- data/lib/fluent/plugin/filter.rb +0 -8
- data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
- data/lib/fluent/plugin/formatter_csv.rb +18 -4
- data/lib/fluent/plugin/formatter_json.rb +7 -4
- data/lib/fluent/plugin/formatter_out_file.rb +5 -2
- data/lib/fluent/plugin/in_forward.rb +9 -5
- data/lib/fluent/plugin/in_http.rb +9 -4
- data/lib/fluent/plugin/in_monitor_agent.rb +4 -8
- data/lib/fluent/plugin/in_tail/position_file.rb +1 -1
- data/lib/fluent/plugin/in_tail.rb +80 -57
- data/lib/fluent/plugin/in_tcp.rb +2 -2
- data/lib/fluent/plugin/in_udp.rb +1 -1
- data/lib/fluent/plugin/input.rb +0 -8
- data/lib/fluent/plugin/multi_output.rb +1 -17
- data/lib/fluent/plugin/out_exec_filter.rb +2 -2
- data/lib/fluent/plugin/out_file.rb +37 -30
- data/lib/fluent/plugin/out_forward/connection_manager.rb +2 -2
- data/lib/fluent/plugin/out_forward.rb +23 -13
- data/lib/fluent/plugin/out_http.rb +1 -1
- data/lib/fluent/plugin/out_secondary_file.rb +2 -2
- data/lib/fluent/plugin/out_stdout.rb +10 -3
- data/lib/fluent/plugin/out_stream.rb +3 -3
- data/lib/fluent/plugin/output.rb +24 -35
- data/lib/fluent/plugin/owned_by_mixin.rb +2 -2
- data/lib/fluent/plugin/parser.rb +3 -3
- data/lib/fluent/plugin/parser_json.rb +3 -3
- data/lib/fluent/plugin/sd_file.rb +2 -2
- data/lib/fluent/plugin/storage_local.rb +8 -4
- data/lib/fluent/plugin.rb +1 -1
- data/lib/fluent/plugin_helper/child_process.rb +2 -2
- data/lib/fluent/plugin_helper/http_server/request.rb +13 -2
- data/lib/fluent/plugin_helper/http_server/server.rb +4 -14
- data/lib/fluent/plugin_helper/http_server.rb +1 -8
- data/lib/fluent/plugin_helper/metrics.rb +7 -0
- data/lib/fluent/plugin_helper/server.rb +4 -1
- data/lib/fluent/plugin_helper/service_discovery.rb +1 -1
- data/lib/fluent/plugin_helper/socket_option.rb +2 -2
- data/lib/fluent/plugin_helper/storage.rb +1 -1
- data/lib/fluent/plugin_id.rb +3 -3
- data/lib/fluent/root_agent.rb +4 -3
- data/lib/fluent/static_config_analysis.rb +3 -2
- data/lib/fluent/supervisor.rb +51 -5
- data/lib/fluent/system_config.rb +13 -4
- data/lib/fluent/test/base.rb +1 -1
- data/lib/fluent/test/driver/base.rb +2 -2
- data/lib/fluent/test/filter_test.rb +2 -2
- data/lib/fluent/test/formatter_test.rb +1 -1
- data/lib/fluent/test/helpers.rb +4 -0
- data/lib/fluent/test/input_test.rb +2 -2
- data/lib/fluent/test/output_test.rb +4 -4
- data/lib/fluent/test/parser_test.rb +1 -1
- data/lib/fluent/test.rb +5 -2
- data/lib/fluent/tls.rb +24 -0
- data/lib/fluent/variable_store.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/winsvc.rb +38 -8
- metadata +77 -16
- data/lib/fluent/plugin_helper/http_server/compat/server.rb +0 -92
- data/lib/fluent/plugin_helper/http_server/compat/ssl_context_extractor.rb +0 -52
- data/lib/fluent/plugin_helper/http_server/compat/webrick_handler.rb +0 -58
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluentd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.19.1
|
|
5
5
|
platform: x64-mingw-ucrt
|
|
6
6
|
authors:
|
|
7
7
|
- Sadayuki Furuhashi
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -200,6 +199,54 @@ dependencies:
|
|
|
200
199
|
- - "~>"
|
|
201
200
|
- !ruby/object:Gem::Version
|
|
202
201
|
version: '1.4'
|
|
202
|
+
- !ruby/object:Gem::Dependency
|
|
203
|
+
name: zstd-ruby
|
|
204
|
+
requirement: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - "~>"
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: '1.5'
|
|
209
|
+
type: :runtime
|
|
210
|
+
prerelease: false
|
|
211
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - "~>"
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '1.5'
|
|
216
|
+
- !ruby/object:Gem::Dependency
|
|
217
|
+
name: uri
|
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '1.0'
|
|
223
|
+
- - "<"
|
|
224
|
+
- !ruby/object:Gem::Version
|
|
225
|
+
version: 1.1.0
|
|
226
|
+
type: :runtime
|
|
227
|
+
prerelease: false
|
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
229
|
+
requirements:
|
|
230
|
+
- - "~>"
|
|
231
|
+
- !ruby/object:Gem::Version
|
|
232
|
+
version: '1.0'
|
|
233
|
+
- - "<"
|
|
234
|
+
- !ruby/object:Gem::Version
|
|
235
|
+
version: 1.1.0
|
|
236
|
+
- !ruby/object:Gem::Dependency
|
|
237
|
+
name: async-http
|
|
238
|
+
requirement: !ruby/object:Gem::Requirement
|
|
239
|
+
requirements:
|
|
240
|
+
- - "~>"
|
|
241
|
+
- !ruby/object:Gem::Version
|
|
242
|
+
version: '0.86'
|
|
243
|
+
type: :runtime
|
|
244
|
+
prerelease: false
|
|
245
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
246
|
+
requirements:
|
|
247
|
+
- - "~>"
|
|
248
|
+
- !ruby/object:Gem::Version
|
|
249
|
+
version: '0.86'
|
|
203
250
|
- !ruby/object:Gem::Dependency
|
|
204
251
|
name: base64
|
|
205
252
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -312,6 +359,20 @@ dependencies:
|
|
|
312
359
|
- - "~>"
|
|
313
360
|
- !ruby/object:Gem::Version
|
|
314
361
|
version: 0.1.7
|
|
362
|
+
- !ruby/object:Gem::Dependency
|
|
363
|
+
name: fiddle
|
|
364
|
+
requirement: !ruby/object:Gem::Requirement
|
|
365
|
+
requirements:
|
|
366
|
+
- - "~>"
|
|
367
|
+
- !ruby/object:Gem::Version
|
|
368
|
+
version: '1.1'
|
|
369
|
+
type: :runtime
|
|
370
|
+
prerelease: false
|
|
371
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
372
|
+
requirements:
|
|
373
|
+
- - "~>"
|
|
374
|
+
- !ruby/object:Gem::Version
|
|
375
|
+
version: '1.1'
|
|
315
376
|
- !ruby/object:Gem::Dependency
|
|
316
377
|
name: rake
|
|
317
378
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -445,19 +506,19 @@ dependencies:
|
|
|
445
506
|
- !ruby/object:Gem::Version
|
|
446
507
|
version: '4'
|
|
447
508
|
- !ruby/object:Gem::Dependency
|
|
448
|
-
name:
|
|
509
|
+
name: console
|
|
449
510
|
requirement: !ruby/object:Gem::Requirement
|
|
450
511
|
requirements:
|
|
451
|
-
- - "
|
|
512
|
+
- - "~>"
|
|
452
513
|
- !ruby/object:Gem::Version
|
|
453
|
-
version:
|
|
514
|
+
version: '1.30'
|
|
454
515
|
type: :development
|
|
455
516
|
prerelease: false
|
|
456
517
|
version_requirements: !ruby/object:Gem::Requirement
|
|
457
518
|
requirements:
|
|
458
|
-
- - "
|
|
519
|
+
- - "~>"
|
|
459
520
|
- !ruby/object:Gem::Version
|
|
460
|
-
version:
|
|
521
|
+
version: '1.30'
|
|
461
522
|
- !ruby/object:Gem::Dependency
|
|
462
523
|
name: aws-sigv4
|
|
463
524
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -519,6 +580,7 @@ extensions: []
|
|
|
519
580
|
extra_rdoc_files: []
|
|
520
581
|
files:
|
|
521
582
|
- ".deepsource.toml"
|
|
583
|
+
- ".rubocop.yml"
|
|
522
584
|
- ADOPTERS.md
|
|
523
585
|
- AUTHORS
|
|
524
586
|
- CHANGELOG.md
|
|
@@ -768,9 +830,6 @@ files:
|
|
|
768
830
|
- lib/fluent/plugin_helper/formatter.rb
|
|
769
831
|
- lib/fluent/plugin_helper/http_server.rb
|
|
770
832
|
- lib/fluent/plugin_helper/http_server/app.rb
|
|
771
|
-
- lib/fluent/plugin_helper/http_server/compat/server.rb
|
|
772
|
-
- lib/fluent/plugin_helper/http_server/compat/ssl_context_extractor.rb
|
|
773
|
-
- lib/fluent/plugin_helper/http_server/compat/webrick_handler.rb
|
|
774
833
|
- lib/fluent/plugin_helper/http_server/methods.rb
|
|
775
834
|
- lib/fluent/plugin_helper/http_server/request.rb
|
|
776
835
|
- lib/fluent/plugin_helper/http_server/router.rb
|
|
@@ -853,8 +912,11 @@ files:
|
|
|
853
912
|
homepage: https://www.fluentd.org/
|
|
854
913
|
licenses:
|
|
855
914
|
- Apache-2.0
|
|
856
|
-
metadata:
|
|
857
|
-
|
|
915
|
+
metadata:
|
|
916
|
+
homepage_uri: https://www.fluentd.org/
|
|
917
|
+
source_code_uri: https://github.com/fluent/fluentd
|
|
918
|
+
changelog_uri: https://github.com/fluent/fluentd/blob/master/CHANGELOG.md
|
|
919
|
+
bug_tracker_uri: https://github.com/fluent/fluentd/issues
|
|
858
920
|
rdoc_options: []
|
|
859
921
|
require_paths:
|
|
860
922
|
- lib
|
|
@@ -862,15 +924,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
862
924
|
requirements:
|
|
863
925
|
- - ">="
|
|
864
926
|
- !ruby/object:Gem::Version
|
|
865
|
-
version: '2
|
|
927
|
+
version: '3.2'
|
|
866
928
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
867
929
|
requirements:
|
|
868
930
|
- - ">="
|
|
869
931
|
- !ruby/object:Gem::Version
|
|
870
932
|
version: '0'
|
|
871
933
|
requirements: []
|
|
872
|
-
rubygems_version: 3.
|
|
873
|
-
signing_key:
|
|
934
|
+
rubygems_version: 3.6.8
|
|
874
935
|
specification_version: 4
|
|
875
936
|
summary: Fluentd event collector
|
|
876
937
|
test_files: []
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Fluentd
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
require 'fluent/plugin_helper/http_server/methods'
|
|
18
|
-
require 'fluent/plugin_helper/http_server/compat/webrick_handler'
|
|
19
|
-
require 'fluent/plugin_helper/http_server/compat/ssl_context_extractor'
|
|
20
|
-
|
|
21
|
-
module Fluent
|
|
22
|
-
module PluginHelper
|
|
23
|
-
module HttpServer
|
|
24
|
-
module Compat
|
|
25
|
-
class Server
|
|
26
|
-
# @param logger [Logger]
|
|
27
|
-
# @param default_app [Object] ignored option. only for compat
|
|
28
|
-
# @param tls_context [OpenSSL::SSL::SSLContext]
|
|
29
|
-
def initialize(addr:, port:, logger:, default_app: nil, tls_context: nil)
|
|
30
|
-
@addr = addr
|
|
31
|
-
@port = port
|
|
32
|
-
@logger = logger
|
|
33
|
-
|
|
34
|
-
config = {
|
|
35
|
-
BindAddress: @addr,
|
|
36
|
-
Port: @port,
|
|
37
|
-
Logger: WEBrick::Log.new(STDERR, WEBrick::Log::FATAL),
|
|
38
|
-
AccessLog: [],
|
|
39
|
-
}
|
|
40
|
-
if tls_context
|
|
41
|
-
require 'webrick/https'
|
|
42
|
-
@logger.warn('Webrick ignores given TLS version')
|
|
43
|
-
tls_opt = Fluent::PluginHelper::HttpServer::Compat::SSLContextExtractor.extract(tls_context)
|
|
44
|
-
config = tls_opt.merge(**config)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
@server = WEBrick::HTTPServer.new(config)
|
|
48
|
-
|
|
49
|
-
# @example ["/example.json", :get, handler object]
|
|
50
|
-
@methods = []
|
|
51
|
-
|
|
52
|
-
if block_given?
|
|
53
|
-
yield(self)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def start(notify = nil)
|
|
58
|
-
build_handler
|
|
59
|
-
notify.push(:ready)
|
|
60
|
-
@logger.debug('Start webrick HTTP server listening')
|
|
61
|
-
@server.start
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def stop
|
|
65
|
-
@server.shutdown
|
|
66
|
-
@server.stop
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
HttpServer::Methods::ALL.map { |e| e.downcase.to_sym }.each do |name|
|
|
70
|
-
define_method(name) do |path, app = nil, &block|
|
|
71
|
-
if (block && app) || (!block && !app)
|
|
72
|
-
raise 'You must specify either app or block in the same time'
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Do not build a handler class here to able to handle multiple methods for single path.
|
|
76
|
-
@methods << [path, name, app || block]
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
private
|
|
81
|
-
|
|
82
|
-
def build_handler
|
|
83
|
-
@methods.group_by(&:first).each do |(path, rest)|
|
|
84
|
-
klass = Fluent::PluginHelper::HttpServer::Compat::WebrickHandler.build(**Hash[rest.map { |e| [e[1], e[2]] }])
|
|
85
|
-
@server.mount(path, klass)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Fluentd
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
module Fluent
|
|
18
|
-
module PluginHelper
|
|
19
|
-
module HttpServer
|
|
20
|
-
module Compat
|
|
21
|
-
# This class converts OpenSSL::SSL::SSLContext to Webrick SSL Config because webrick does not have interface to pass OpenSSL::SSL::SSLContext directory
|
|
22
|
-
# https://github.com/ruby/webrick/blob/v1.6.0/lib/webrick/ssl.rb#L67-L88
|
|
23
|
-
class SSLContextExtractor
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
# memo: https://github.com/ruby/webrick/blob/v1.6.0/lib/webrick/ssl.rb#L180-L205
|
|
27
|
-
# @param ctx [OpenSSL::SSL::SSLContext]
|
|
28
|
-
def self.extract(ctx)
|
|
29
|
-
{
|
|
30
|
-
SSLEnable: true,
|
|
31
|
-
SSLPrivateKey: ctx.key,
|
|
32
|
-
SSLCertificate: ctx.cert,
|
|
33
|
-
SSLClientCA: ctx.client_ca,
|
|
34
|
-
SSLExtraChainCert: ctx.extra_chain_cert,
|
|
35
|
-
SSLCACertificateFile: ctx.ca_file,
|
|
36
|
-
SSLCACertificatePath: ctx.ca_path,
|
|
37
|
-
SSLCertificateStore: ctx.cert_store,
|
|
38
|
-
SSLTmpDhCallback: ctx.tmp_dh_callback,
|
|
39
|
-
SSLVerifyClient: ctx.verify_mode,
|
|
40
|
-
SSLVerifyDepth: ctx.verify_depth,
|
|
41
|
-
SSLVerifyCallback: ctx.verify_callback,
|
|
42
|
-
SSLServerNameCallback: ctx.servername_cb,
|
|
43
|
-
SSLTimeout: ctx.timeout,
|
|
44
|
-
SSLOptions: ctx.options,
|
|
45
|
-
SSLCiphers: ctx.ciphers,
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Fluentd
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
require 'webrick'
|
|
18
|
-
require 'json'
|
|
19
|
-
|
|
20
|
-
module Fluent
|
|
21
|
-
module PluginHelper
|
|
22
|
-
module HttpServer
|
|
23
|
-
module Compat
|
|
24
|
-
class WebrickHandler
|
|
25
|
-
# **opt is enough. but I wrote a signature explicitly for readability
|
|
26
|
-
def self.build(get: nil, head: nil, post: nil, put: nil, patch: nil, delete: nil, connect: nil, options: nil, trace: nil)
|
|
27
|
-
opt = { get: get, head: head, post: post, put: put, patch: patch, delete: delete, connect: connect, options: options, trace: trace }
|
|
28
|
-
|
|
29
|
-
Class.new(WEBrick::HTTPServlet::AbstractServlet) do
|
|
30
|
-
HttpServer::Methods::ALL.each do |name|
|
|
31
|
-
define_method("do_#{name}") do |request, response|
|
|
32
|
-
code, headers, body =
|
|
33
|
-
if request.path_info != ''
|
|
34
|
-
render_json(404, 'message' => 'Not found')
|
|
35
|
-
else
|
|
36
|
-
begin
|
|
37
|
-
opt[name.downcase.to_sym].call(request)
|
|
38
|
-
rescue => _
|
|
39
|
-
render_json(500, 'message' => 'Something went wrong')
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
response.status = code
|
|
44
|
-
headers.each { |k, v| response[k] = v }
|
|
45
|
-
response.body = body
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def render_json(code, obj)
|
|
50
|
-
[code, { 'Content-Type' => 'application/json' }, obj.to_json]
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|