rails-letsencrypt 0.11.3 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0edc7fb113891045af86b87c2804503f58df7c77c3141dd613da62e14f70a41
4
- data.tar.gz: e4049903145539cc020d3568c62d0e92f221909fe1c7696c9b8e72939ca7292e
3
+ metadata.gz: 3e68d1fe64e1617ce8806c9b5b37ec2262fc0364d6760bdd7102e209064cdc72
4
+ data.tar.gz: d0a907c1d281e450c648793373d1b52b4dba5a0cc04fb4e7158335a9d39c6d04
5
5
  SHA512:
6
- metadata.gz: 885f68a89b22a6ae3abd0aa89b4d4cf868124fef706877b7e8f874212b590c7ed27af2ac1c46c2b9807a224393d60a43b3879609e46b1cf4d0d3e354e1f594bb
7
- data.tar.gz: 4b0c77625b7cbc70fb120cb8554e780304478e17dd8c26fda1f220b630cdad15d98382186db41a1cfc89dcfec5c73f8af1b34632982cfec5178c09161a749822
6
+ metadata.gz: c60b81e40b6ac0fbbf2f984131ee7552f8130a7ecff3da572940b85ffba71068222fcb1f861d45590aeff40519f4afcf44a9e28cd63eff6c7feb178abaaf490a
7
+ data.tar.gz: 777b086600489784480ceaa8c96ed86ce45f8560724eb7b0c097071fd5518bd5dea979c429511be83e00b6fb8e897efabbfa301fae5c3829463b48e3579fe706
data/README.md CHANGED
@@ -1,11 +1,16 @@
1
- # LetsEncrypt [![Gem Version](https://badge.fury.io/rb/rails-letsencrypt.svg)](https://badge.fury.io/rb/rails-letsencrypt) [![Code Climate](https://codeclimate.com/github/elct9620/rails-letsencrypt/badges/gpa.svg)](https://codeclimate.com/github/elct9620/rails-letsencrypt)
1
+ Rails LetsEncrypt
2
+ ===
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/rails-letsencrypt.svg)](https://badge.fury.io/rb/rails-letsencrypt)
5
+ [![Code Climate](https://codeclimate.com/github/elct9620/rails-letsencrypt/badges/gpa.svg)](https://codeclimate.com/github/elct9620/rails-letsencrypt)
6
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/elct9620/rails-letsencrypt)
2
7
 
3
8
  Provide manageable Let's Encrypt Certificate for Rails.
4
9
 
5
10
  ## Requirement
6
11
 
7
- * Rails 6.1+
8
- * Ruby 2.7+
12
+ * Rails 7.2+
13
+ * Ruby 3.2+
9
14
 
10
15
  ## Installation
11
16
 
@@ -64,7 +69,7 @@ LetsEncrypt.config do |config|
64
69
 
65
70
  # Enable it if you want to customize the model
66
71
  # Default is LetsEncrypt::Certificate
67
- #config.certificate_model = 'MyCertificate'
72
+ # config.certificate_model = 'MyCertificate'
68
73
  end
69
74
  ```
70
75
 
@@ -200,9 +205,5 @@ server {
200
205
  }
201
206
  ```
202
207
 
203
- ### Kong
204
-
205
- Coming soon.
206
-
207
208
  ## License
208
209
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -25,7 +25,7 @@ module LetsEncrypt
25
25
  end
26
26
 
27
27
  def create_certificate
28
- order.finalize(csr: csr)
28
+ order.finalize(csr:)
29
29
  sleep 1 while order.status == 'processing'
30
30
  fullchain = order.certificate.split("\n\n")
31
31
  assign_new_certificate(fullchain)
@@ -32,7 +32,7 @@ module LetsEncrypt
32
32
 
33
33
  scope :active, -> { where('certificate IS NOT NULL AND expires_at > ?', Time.zone.now) }
34
34
  scope :renewable, -> { where('renew_after IS NULL OR renew_after <= ?', Time.zone.now) }
35
- scope :expired, -> { where('expires_at <= ?', Time.zone.now) }
35
+ scope :expired, -> { where(expires_at: ..Time.zone.now) }
36
36
 
37
37
  before_create -> { self.key = OpenSSL::PKey::RSA.new(4096).to_s }
38
38
  after_destroy -> { delete_from_redis }, if: -> { LetsEncrypt.config.use_redis? && active? }
@@ -53,7 +53,7 @@ module LetsEncrypt
53
53
 
54
54
  # Returns true if success get a new certificate
55
55
  def get
56
- ActiveSupport::Notifications.instrument('letsencrypt.issue', domain: domain) do
56
+ ActiveSupport::Notifications.instrument('letsencrypt.issue', domain:) do
57
57
  verify && issue
58
58
  end
59
59
  end
@@ -21,6 +21,10 @@ module LetsEncrypt
21
21
  'db/migrate/create_letsencrypt_certificates.rb'
22
22
  end
23
23
 
24
+ def copy_config
25
+ copy_file 'letsencrypt.rb', 'config/initializers/letsencrypt.rb'
26
+ end
27
+
24
28
  def required_migration_version?
25
29
  Rails::VERSION::MAJOR >= 5
26
30
  end
@@ -0,0 +1,28 @@
1
+ LetsEncrypt.config do |config|
2
+ # Using Let's Encrypt staging server or not
3
+ # Default only `Rails.env.production? == true` will use Let's Encrypt production server.
4
+ config.use_staging = true
5
+
6
+ # Set the private key path
7
+ # Default is locate at config/letsencrypt.key
8
+ config.private_key_path = Rails.root.join('config', 'letsencrypt.key')
9
+
10
+ # Use environment variable to set private key
11
+ # If enable, the API Client will use `LETSENCRYPT_PRIVATE_KEY` as private key
12
+ # Default is false
13
+ config.use_env_key = false
14
+
15
+ # Should sync certificate into redis
16
+ # When using ngx_mruby to dynamic load certificate, this will be helpful
17
+ # Default is false
18
+ config.save_to_redis = false
19
+
20
+ # The redis server url
21
+ # Default is nil
22
+ config.redis_url = 'redis://localhost:6379/1'
23
+
24
+ # Enable it if you want to customize the model
25
+ # Default is LetsEncrypt::Certificate
26
+ # config.certificate_model = 'MyCertificate'
27
+ end
28
+
@@ -15,10 +15,10 @@ module LetsEncrypt
15
15
  @tags = @tags.uniq
16
16
  end
17
17
 
18
- def tag(logger, &block)
18
+ def tag(logger, &)
19
19
  if logger.respond_to?(:tagged)
20
20
  current_tags = tags - logger.formatter.current_tags
21
- logger.tagged(*current_tags, &block)
21
+ logger.tagged(*current_tags, &)
22
22
  else
23
23
  yield
24
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LetsEncrypt
4
- VERSION = '0.11.3'
4
+ VERSION = '0.12.0'
5
5
  end
data/lib/letsencrypt.rb CHANGED
@@ -22,8 +22,8 @@ module LetsEncrypt
22
22
  # Create the ACME Client to Let's Encrypt
23
23
  def client
24
24
  @client ||= ::Acme::Client.new(
25
- private_key: private_key,
26
- directory: directory
25
+ private_key:,
26
+ directory:
27
27
  )
28
28
  end
29
29
 
@@ -77,9 +77,9 @@ module LetsEncrypt
77
77
  # # Always use production mode to connect Let's Encrypt API server
78
78
  # config.use_staging = false
79
79
  # end
80
- def config(&block)
80
+ def config(&)
81
81
  @config ||= Configuration.new
82
- instance_exec(@config, &block) if block_given?
82
+ instance_exec(@config, &) if block_given?
83
83
  @config
84
84
  end
85
85
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-letsencrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-02-13 00:00:00.000000000 Z
10
+ date: 2025-05-16 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: acme-client
@@ -156,6 +155,7 @@ files:
156
155
  - config/routes.rb
157
156
  - lib/generators/lets_encrypt/install_generator.rb
158
157
  - lib/generators/lets_encrypt/register_generator.rb
158
+ - lib/generators/lets_encrypt/templates/letsencrypt.rb
159
159
  - lib/generators/lets_encrypt/templates/migration.rb
160
160
  - lib/letsencrypt.rb
161
161
  - lib/letsencrypt/configuration.rb
@@ -171,7 +171,6 @@ licenses:
171
171
  - MIT
172
172
  metadata:
173
173
  rubygems_mfa_required: 'true'
174
- post_install_message:
175
174
  rdoc_options: []
176
175
  require_paths:
177
176
  - lib
@@ -179,15 +178,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
178
  requirements:
180
179
  - - ">="
181
180
  - !ruby/object:Gem::Version
182
- version: 2.7.0
181
+ version: 3.2.0
183
182
  required_rubygems_version: !ruby/object:Gem::Requirement
184
183
  requirements:
185
184
  - - ">="
186
185
  - !ruby/object:Gem::Version
187
186
  version: '0'
188
187
  requirements: []
189
- rubygems_version: 3.1.6
190
- signing_key:
188
+ rubygems_version: 3.6.2
191
189
  specification_version: 4
192
190
  summary: The Let's Encrypt certificate manager for rails
193
191
  test_files: []