forest_admin_rpc_agent 1.14.2 → 1.14.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a10b7e864a52e9676b1585a021e1b5abde7a724aeea3e8e9c167dcfa1e9953b
4
- data.tar.gz: d3672c83a7f469d98bd200553d98a1188da2b886f063e08c6d28d6bf71abb0fc
3
+ metadata.gz: a0b29388c9259dd65fd78333575a61c94bfb17a5c5252bd6bc134617dd9a047d
4
+ data.tar.gz: fb83146a2e6a9f293ddcef134cc783e719fa364539c6f6b0f22089e4790669ca
5
5
  SHA512:
6
- metadata.gz: 312ee61b94309574d4af61a5f45a394617c9f3b9ade025eef6388968a8e7f2968d931c4f9efc1d233d7611b26545a69275d487ac1536135af11b4a2310911aab
7
- data.tar.gz: 2eefc4a81a3a10888348b26e8c4e8c390b025a31ce334968b88bfc65014c6bb7d451c479aef2320a046d01ddfb0f52a3f9de7c1d5d0837106b919551a4c7c439
6
+ metadata.gz: ee9ffd869cc213e77f60a01005823db71f122a05e3b570c89850d0f38ddf7cd76f461513b36560c9064c81ddc82e7b55fc191bb206533c60cb0b84bb066b2d3d
7
+ data.tar.gz: 7e0415a83fde513f4b77fc521339c661a65d9e2d8ca511b2a64524542f4323f1f3151645b9ce50e1c24e722a415397ce98c370304ae7bd32795d84ba27d2dff4
@@ -21,7 +21,13 @@ module ForestAdminRpcAgent
21
21
  def register_sinatra(app)
22
22
  app.send(@method.to_sym, @url) do
23
23
  result = handle_request(params)
24
- serialize_response(result)
24
+
25
+ if result.is_a?(Hash) && result.key?(:status)
26
+ status result[:status]
27
+ result[:content] ? serialize_response(result[:content]) : ''
28
+ else
29
+ serialize_response(result)
30
+ end
25
31
  end
26
32
  end
27
33
 
@@ -29,15 +35,22 @@ module ForestAdminRpcAgent
29
35
  handler = proc do |hash|
30
36
  request = ActionDispatch::Request.new(hash)
31
37
 
32
- auth_middleware = ForestAdminRpcAgent::Middleware::Authentication.new(->(_env) { [200, {}, ['OK']] })
33
- status, headers, response = auth_middleware.call(request.env)
34
-
35
- if status == 200
38
+ # Skip authentication for health check (root path)
39
+ if @url == '/'
36
40
  params = request.query_parameters.merge(request.request_parameters)
37
- result = handle_request({ params: params, caller: headers[:caller] })
41
+ result = handle_request({ params: params, caller: nil })
38
42
  [200, { 'Content-Type' => 'application/json' }, [serialize_response(result)]]
39
43
  else
40
- [status, headers, response]
44
+ auth_middleware = ForestAdminRpcAgent::Middleware::Authentication.new(->(_env) { [200, {}, ['OK']] })
45
+ status, headers, response = auth_middleware.call(request.env)
46
+
47
+ if status == 200
48
+ params = request.query_parameters.merge(request.request_parameters)
49
+ result = handle_request({ params: params, caller: headers[:caller] })
50
+ [200, { 'Content-Type' => 'application/json' }, [serialize_response(result)]]
51
+ else
52
+ [status, headers, response]
53
+ end
41
54
  end
42
55
  end
43
56
 
@@ -2,11 +2,11 @@ module ForestAdminRpcAgent
2
2
  module Routes
3
3
  class HealthRoute < BaseRoute
4
4
  def initialize
5
- super('health', 'get', 'rpc_forest')
5
+ super('/', 'get', 'rpc_forest')
6
6
  end
7
7
 
8
8
  def handle_request(_params)
9
- { status: 'ok', message: 'Forest Admin RPC Agent is running' }.to_json
9
+ { error: nil, message: 'Agent is running' }
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRpcAgent
2
- VERSION = "1.14.2"
2
+ VERSION = "1.14.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_rpc_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.2
4
+ version: 1.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-11-12 00:00:00.000000000 Z
12
+ date: 2025-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64