relintio-agent 0.1.3 → 0.1.4
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/README.md +10 -1
- data/lib/relintio-agent.rb +10 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63230d8e403b01c4b1d8dd269d5ddb8a06834ae57216c2552f93340d2acca55f
|
|
4
|
+
data.tar.gz: 0da7df209325ba16faf46cf500543315b68c4b8fc68718688819f7f90b2f4118
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a755ee062d8e1e125fc1f3e5397359670042f5a7e636e7e9d6b87ebab9f033651ea354853529844505935861924ed882ea68172ade817aad4c4596b2a165d957
|
|
7
|
+
data.tar.gz: 689b7ce18e419c163d5b46015102af25fc2176803f8c69fa394787c5c1f6635408ae7060fc18b845384c9cf1eb8d5669b225f6efe50261ddd328f8efc780b59a
|
data/README.md
CHANGED
|
@@ -10,6 +10,15 @@ Add the gem to your application's Gemfile:
|
|
|
10
10
|
gem 'relintio-agent', github: 'Relintio/relintio-ruby-agent'
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Dashboard Deployment Workflow
|
|
14
|
+
|
|
15
|
+
1. Open **Dashboard → Deployment**, select **Ruby**, and choose Rails or Sinatra.
|
|
16
|
+
2. Download the prepared starter and insert the Relintio Rack middleware before the application.
|
|
17
|
+
3. Restart the Rack server, then open one public route.
|
|
18
|
+
4. Enter that exact URL or public IP endpoint in Relintio and select **Verify target**.
|
|
19
|
+
|
|
20
|
+
The SDK reports runtime kind `ruby` and its version during rule synchronization. Policy revisions are received automatically.
|
|
21
|
+
|
|
13
22
|
And then execute:
|
|
14
23
|
```bash
|
|
15
24
|
bundle install
|
|
@@ -41,7 +50,7 @@ end
|
|
|
41
50
|
agent = Relintio::Agent.new(
|
|
42
51
|
license_key: "YOUR_LICENSE_KEY",
|
|
43
52
|
domain: "example.com",
|
|
44
|
-
api_url: "https://relintio.com/
|
|
53
|
+
api_url: "https://api.relintio.com/v1"
|
|
45
54
|
)
|
|
46
55
|
agent.start_sync
|
|
47
56
|
|
data/lib/relintio-agent.rb
CHANGED
|
@@ -5,16 +5,16 @@ require 'thread'
|
|
|
5
5
|
|
|
6
6
|
module Relintio
|
|
7
7
|
class Agent
|
|
8
|
-
AGENT_VERSION = '0.1.
|
|
8
|
+
AGENT_VERSION = '0.1.2'
|
|
9
9
|
|
|
10
10
|
attr_reader :config, :rules
|
|
11
11
|
|
|
12
12
|
def initialize(config = {})
|
|
13
13
|
@config = {
|
|
14
14
|
license_key: config[:license_key],
|
|
15
|
-
api_url: config[:api_url] || "https://relintio.com/
|
|
15
|
+
api_url: config[:api_url] || "https://api.relintio.com/v1",
|
|
16
16
|
domain: config[:domain] || '',
|
|
17
|
-
sync_interval: config[:sync_interval] ||
|
|
17
|
+
sync_interval: [config[:sync_interval] || 10, 10].max
|
|
18
18
|
}
|
|
19
19
|
@rules = []
|
|
20
20
|
@rules_mutex = Mutex.new
|
|
@@ -28,9 +28,12 @@ module Relintio
|
|
|
28
28
|
return @sync_thread if @sync_thread&.alive?
|
|
29
29
|
|
|
30
30
|
@sync_thread = Thread.new do
|
|
31
|
+
failures = 0
|
|
31
32
|
while @running
|
|
32
|
-
sync_rules
|
|
33
|
-
|
|
33
|
+
success = sync_rules
|
|
34
|
+
failures = success ? 0 : [failures + 1, 5].min
|
|
35
|
+
base = [@config[:sync_interval] * (2**failures), 300].min
|
|
36
|
+
sleep [base * rand(0.8..1.2), 10].max
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
@sync_thread.report_on_exception = false
|
|
@@ -67,10 +70,12 @@ module Relintio
|
|
|
67
70
|
@rules_mutex.synchronize do
|
|
68
71
|
@rules = data['rules'] || []
|
|
69
72
|
end
|
|
73
|
+
return true
|
|
70
74
|
end
|
|
71
75
|
rescue StandardError
|
|
72
76
|
# Fail-open: ignore errors during sync
|
|
73
77
|
end
|
|
78
|
+
false
|
|
74
79
|
end
|
|
75
80
|
|
|
76
81
|
def check_request(request)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relintio-agent
|
|
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
|
- Relintio Operations
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|