on_strum-healthcheck 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 49506d15af7f2a697b464a09f7e8ee603545714e0461ad9e58438260fc90a19f
4
- data.tar.gz: dbacd0cc9ed4983e964974ca669355f76173992aec19ab2e529a91dafea461f9
3
+ metadata.gz: e83d58e450413cfde81bf7e671e98b905fd5143783215bd48cb75b6e7302fd6f
4
+ data.tar.gz: 579db98df237a8bc426943ca3bd7dfec79099cf50c2afdc550ef665b62eaa080
5
5
  SHA512:
6
- metadata.gz: 99be94127829f725b296eed4c2e33b0d9155227568a8e4365ed21ea396f015fb2fa425230546771eed395b3a17ca32ad863a5ecd2353021ac1f64ac74e8cfdff
7
- data.tar.gz: 64889d09e6980042ab94b45d527a62828a768e3a51b74af6e1ec8c8a8e155142728b27bad1231fec29d543fdbaa84b9f9fcc90688b9b68550a05e1b79ee34ba6
6
+ metadata.gz: 1cd7bf655887c29271ed253d18ab0c841b8888aba438adfc262cdf8fd18884d65347a70db51e582ceb443fbf854103ac4691f99032e2a832d9539501e1f356fa
7
+ data.tar.gz: 700639dc0e4241decc644139d478bac65cdb7f38627f74341c0bc4f55b67d6bb47ca73e8ba45ce06e32ed1fc90aded7c5eae6cfae0bd291c3a320d21a0a0160f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [0.2.0] - 2024-03-28
6
+
7
+ ### Added
8
+
9
+ - Added ability to use configuration with default settings without block passing
10
+
11
+ ```ruby
12
+ OnStrum::Healthcheck.configure # It will create configuration instance with default settings
13
+ ```
14
+
15
+ ### Updated
16
+
17
+ - Updated `OnStrum::Healthcheck.configure`, tests
18
+ - Updated gem documentation
19
+
5
20
  ## [0.1.0] - 2024-03-26
6
21
 
7
22
  ### Added
data/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/b4dc21883d489d67fbef/maintainability)](https://codeclimate.com/github/on-strum/ruby-on-strum-healthcheck/maintainability)
4
4
  [![Test Coverage](https://api.codeclimate.com/v1/badges/b4dc21883d489d67fbef/test_coverage)](https://codeclimate.com/github/on-strum/ruby-on-strum-healthcheck/test_coverage)
5
5
  [![CircleCI](https://circleci.com/gh/on-strum/ruby-on-strum-healthcheck/tree/master.svg?style=svg)](https://circleci.com/gh/on-strum/ruby-on-strum-healthcheck/tree/master)
6
- [![Gem Version](https://badge.fury.io/rb/ruby_healthcheck.svg)](https://badge.fury.io/rb/ruby_healthcheck)
7
- [![Downloads](https://img.shields.io/gem/dt/ruby_healthcheck.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/ruby_healthcheck)
6
+ [![Gem Version](https://badge.fury.io/rb/on_strum-healthcheck.svg)](https://badge.fury.io/rb/on_strum-healthcheck)
7
+ [![Downloads](https://img.shields.io/gem/dt/on_strum-healthcheck.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/on_strum-healthcheck)
8
8
  [![GitHub](https://img.shields.io/github/license/on-strum/ruby-on-strum-healthcheck)](LICENSE.txt)
9
9
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
10
10
 
@@ -17,10 +17,12 @@ Simple configurable application healthcheck rack middleware. This middleware all
17
17
  - [Installation](#installation)
18
18
  - [Configuring](#configuring)
19
19
  - [Usage](#usage)
20
- - [Rack](#rack)
21
- - [Roda](#roda)
22
- - [Hanami](#hanami)
23
- - [Rails](#rails)
20
+ - [Integration](#integration)
21
+ - [Rack](#rack)
22
+ - [Roda](#roda)
23
+ - [Hanami](#hanami)
24
+ - [Rails](#rails)
25
+ - [Healthcheck endpoint response](#healthcheck-endpoint-response)
24
26
  - [Contributing](#contributing)
25
27
  - [License](#license)
26
28
  - [Code of Conduct](#code-of-conduct)
@@ -143,28 +145,30 @@ end
143
145
 
144
146
  ## Usage
145
147
 
148
+ ### Integration
149
+
146
150
  Please note, to start using this middleware you should configure `OnStrum::Healthcheck` before and then you should to add `OnStrum::Healthcheck::RackMiddleware` on the top of middlewares list.
147
151
 
148
- ### Rack
152
+ #### Rack
149
153
 
150
154
  ```ruby
151
- require 'rack'
152
155
  require 'on_strum/healthcheck'
153
156
 
157
+ # Configuring OnStrum::Healthcheck with default settings
154
158
  OnStrum::Healthcheck.configure
155
159
 
156
- RackCascade = Rack::Builder.app do
160
+ Rack::Builder.app do
157
161
  use OnStrum::Healthcheck::RackMiddleware
158
162
  run YourApplication
159
163
  end
160
164
  ```
161
165
 
162
- ### Roda
166
+ #### Roda
163
167
 
164
168
  ```ruby
165
- require 'roda'
166
169
  require 'on_strum/healthcheck'
167
170
 
171
+ # Configuring OnStrum::Healthcheck with default settings
168
172
  OnStrum::Healthcheck.configure
169
173
 
170
174
  class YourApplication < Roda
@@ -172,15 +176,18 @@ class YourApplication < Roda
172
176
  end
173
177
  ```
174
178
 
175
- ### Hanami
179
+ #### Hanami
176
180
 
177
181
  ```ruby
178
182
  # config/initializers/on_strum_healthcheck.rb
179
183
 
180
184
  require 'on_strum/healthcheck'
181
185
 
186
+ # Configuring OnStrum::Healthcheck with default settings
182
187
  OnStrum::Healthcheck.configure
188
+ ```
183
189
 
190
+ ```ruby
184
191
  # config/environment.rb
185
192
 
186
193
  Hanami.configure do
@@ -188,18 +195,41 @@ Hanami.configure do
188
195
  end
189
196
  ```
190
197
 
191
- ### Rails
198
+ #### Rails
192
199
 
193
200
  ```ruby
194
201
  # config/initializers/on_strum_healthcheck.rb
195
202
 
196
203
  require 'on_strum/healthcheck'
197
204
 
205
+ # Configuring OnStrum::Healthcheck with default settings
198
206
  OnStrum::Healthcheck.configure
207
+ ```
199
208
 
209
+ ```ruby
200
210
  # config/application.rb
201
211
 
202
- config.middleware.use OnStrum::Healthcheck::RackMiddleware
212
+ class Application < Rails::Application
213
+ config.middleware.use OnStrum::Healthcheck::RackMiddleware
214
+ end
215
+ ```
216
+
217
+ ### Healthcheck endpoint response
218
+
219
+ Each healthcheck endpoint returns proper HTTP status and body. Determining the response status is based on the general result of service checks (when all are successful the status is successful, at least one failure - the status is failure). The response body represented as JSON document with a structure like in the example below:
220
+
221
+ ```json
222
+ {
223
+ "data": {
224
+ "id": "a09efd18-e09f-4207-9a43-b4bf89f76b47",
225
+ "type": "application-healthcheck",
226
+ "attributes": {
227
+ "postges": true,
228
+ "redis": true,
229
+ "rebbit": true
230
+ }
231
+ }
232
+ }
203
233
  ```
204
234
 
205
235
  ## Contributing
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OnStrum
4
4
  module Healthcheck
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -14,6 +14,8 @@ module OnStrum
14
14
  end
15
15
 
16
16
  def configure(&block)
17
+ return configuration {} unless block # rubocop:disable Lint/EmptyBlock
18
+
17
19
  configuration(&block)
18
20
  end
19
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_strum-healthcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Trotsenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-26 00:00:00.000000000 Z
11
+ date: 2024-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack