litestream 0.10.5-x86_64-linux → 0.11.1-x86_64-linux

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: cd802db15c80c8c8d0edeb4c2c06edd45ea5839c3894aaf5c37b0b7c40a90e44
4
- data.tar.gz: 1e12d2ea89fdd2f5df867732527b0ad2c7edde1d8e0099b1d1508244b10ebe26
3
+ metadata.gz: 6a9f16ce55743fe9df0c95618386bfb067d11f6532c19a45b67400fbb3d4d6a2
4
+ data.tar.gz: 0f6a8a90b7f1b99b51faa22a0c313cf093f74a442a4f01ea581add1e20563b5a
5
5
  SHA512:
6
- metadata.gz: db570e83a48459c2e61323c400474ed1cfcfdbfe019ef3a8387940be36a2536f56c831eebefecccd14d77b72781bc937ea6773c8a0ef8e6d80d3d84217eae381
7
- data.tar.gz: f055d4c1947c8653842b8dc7f6b16b85e98b9c3d4bf7f93900ffa38ccc989e56d044bbf03a4bfd9e6579c3a2b798764b6d801230e07f6a64ec0a0c0d986f1259
6
+ metadata.gz: 63a00c18f1556246fd260fbb60961bc67b08c1225069c02ccfe485e85c84f1563e501a01f67ae480706642e627c2ad91a8c63ae94b432afa657b6775235a2351
7
+ data.tar.gz: bab14cb66426a2ef5a1345de440a0d7d9b4fe2515d88ff2b3cb234d5a7b788c6bdd3ebd599a3139c947dd820b96e648f3f14e1f3d25e8904012b7d69458ed640
@@ -3,7 +3,12 @@ module Litestream
3
3
  protect_from_forgery with: :exception
4
4
  around_action :force_english_locale!
5
5
 
6
- http_basic_authenticate_with name: Litestream.username, password: Litestream.password if Litestream.password
6
+ if Litestream.password
7
+ http_basic_authenticate_with(
8
+ name: Litestream.username,
9
+ password: Litestream.password
10
+ )
11
+ end
7
12
 
8
13
  private
9
14
 
@@ -0,0 +1,13 @@
1
+ require "active_job"
2
+
3
+ module Litestream
4
+ class VerificationJob < ActiveJob::Base
5
+ queue_as Litestream.queue
6
+
7
+ def perform
8
+ Litestream::Commands.databases.each do |db_hash|
9
+ Litestream.verify!(db_hash["path"])
10
+ end
11
+ end
12
+ end
13
+ end
@@ -118,11 +118,9 @@ module Litestream
118
118
  end
119
119
 
120
120
  def prepare(command, argv = {}, database = nil)
121
- if Litestream.configuration
122
- ENV["LITESTREAM_REPLICA_BUCKET"] ||= Litestream.configuration.replica_bucket
123
- ENV["LITESTREAM_ACCESS_KEY_ID"] ||= Litestream.configuration.replica_key_id
124
- ENV["LITESTREAM_SECRET_ACCESS_KEY"] ||= Litestream.configuration.replica_access_key
125
- end
121
+ ENV["LITESTREAM_REPLICA_BUCKET"] ||= Litestream.replica_bucket
122
+ ENV["LITESTREAM_ACCESS_KEY_ID"] ||= Litestream.replica_key_id
123
+ ENV["LITESTREAM_SECRET_ACCESS_KEY"] ||= Litestream.replica_access_key
126
124
 
127
125
  args = {
128
126
  "--config" => Rails.root.join("config", "litestream.yml").to_s
@@ -18,5 +18,9 @@ module Litestream
18
18
  Litestream.public_send(:"#{name}=", value)
19
19
  end
20
20
  end
21
+
22
+ initializer "deprecator" do |app|
23
+ app.deprecators[:litestream] = Litestream.deprecator
24
+ end
21
25
  end
22
26
  end
@@ -4,7 +4,7 @@
4
4
  # This allows you to configure Litestream using Rails encrypted credentials,
5
5
  # or some other mechanism where the values are only avaialble at runtime.
6
6
 
7
- Litestream.configure do |config|
7
+ Rails.application.configure do
8
8
  # An example of using Rails encrypted credentials to configure Litestream.
9
9
  # litestream_credentials = Rails.application.credentials.litestream
10
10
 
@@ -19,15 +19,15 @@ Litestream.configure do |config|
19
19
  # any SFTP server.
20
20
  # In this example, we are using Rails encrypted credentials to store the URL to
21
21
  # our storage provider bucket.
22
- # config.replica_bucket = litestream_credentials.replica_bucket
22
+ # config.litestream.replica_bucket = litestream_credentials&.replica_bucket
23
23
 
24
24
  # Replica-specific authentication key.
25
25
  # Litestream needs authentication credentials to access your storage provider bucket.
26
26
  # In this example, we are using Rails encrypted credentials to store the access key ID.
27
- # config.replica_key_id = litestream_credentials.replica_key_id
27
+ # config.litestream.replica_key_id = litestream_credentials&.replica_key_id
28
28
 
29
29
  # Replica-specific secret key.
30
30
  # Litestream needs authentication credentials to access your storage provider bucket.
31
31
  # In this example, we are using Rails encrypted credentials to store the secret access key.
32
- # config.replica_access_key = litestream_credentials.replica_access_key
32
+ # config.litestream.replica_access_key = litestream_credentials&.replica_access_key
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module Litestream
2
- VERSION = "0.10.5"
2
+ VERSION = "0.11.1"
3
3
  end
data/lib/litestream.rb CHANGED
@@ -3,11 +3,25 @@
3
3
  require "sqlite3"
4
4
 
5
5
  module Litestream
6
+ VerificationFailure = Class.new(StandardError)
7
+
6
8
  class << self
7
- attr_accessor :configuration
9
+ attr_writer :configuration
10
+
11
+ def configuration
12
+ @configuration ||= Configuration.new
13
+ end
14
+
15
+ def deprecator
16
+ @deprecator ||= ActiveSupport::Deprecation.new("0.12.0", "Litestream")
17
+ end
8
18
  end
9
19
 
10
20
  def self.configure
21
+ deprecator.warn(
22
+ 'Configuring Litestream via Litestream.configure is deprecated. Use Rails.application.configure { config.litestream.* = ... } instead.',
23
+ caller
24
+ )
11
25
  self.configuration ||= Configuration.new
12
26
  yield(configuration)
13
27
  end
@@ -19,10 +33,7 @@ module Litestream
19
33
  end
20
34
  end
21
35
 
22
- VerificationFailure = Class.new(StandardError)
23
-
24
- mattr_writer :username
25
- mattr_writer :password
36
+ mattr_writer :username, :password, :queue, :replica_bucket, :replica_key_id, :replica_access_key
26
37
 
27
38
  class << self
28
39
  def verify!(database_path)
@@ -51,15 +62,29 @@ module Litestream
51
62
  # use method instead of attr_accessor to ensure
52
63
  # this works if variable set after Litestream is loaded
53
64
  def username
54
- @username ||= ENV["LITESTREAM_USERNAME"] || @@username
65
+ @username ||= ENV["LITESTREAM_USERNAME"] || @@username || "litestream"
55
66
  end
56
67
 
57
- # use method instead of attr_accessor to ensure
58
- # this works if variable set after Litestream is loaded
59
68
  def password
60
69
  @password ||= ENV["LITESTREAM_PASSWORD"] || @@password
61
70
  end
62
71
 
72
+ def queue
73
+ @queue ||= ENV["LITESTREAM_QUEUE"] || @@queue || "default"
74
+ end
75
+
76
+ def replica_bucket
77
+ @replica_bucket ||= @@replica_bucket || configuration.replica_bucket
78
+ end
79
+
80
+ def replica_key_id
81
+ @replica_key_id ||= @@replica_key_id || configuration.replica_key_id
82
+ end
83
+
84
+ def replica_access_key
85
+ @replica_access_key ||= @@replica_access_key || configuration.replica_access_key
86
+ end
87
+
63
88
  def replicate_process
64
89
  info = {}
65
90
  if !`which systemctl`.empty?
@@ -1,14 +1,9 @@
1
1
  namespace :litestream do
2
2
  desc "Print the ENV variables needed for the Litestream config file"
3
3
  task env: :environment do
4
- if Litestream.configuration.nil?
5
- warn "You have not configured the Litestream gem with any values to generate ENV variables"
6
- next
7
- end
8
-
9
- puts "LITESTREAM_REPLICA_BUCKET=#{Litestream.configuration.replica_bucket}"
10
- puts "LITESTREAM_ACCESS_KEY_ID=#{Litestream.configuration.replica_key_id}"
11
- puts "LITESTREAM_SECRET_ACCESS_KEY=#{Litestream.configuration.replica_access_key}"
4
+ puts "LITESTREAM_REPLICA_BUCKET=#{Litestream.replica_bucket}"
5
+ puts "LITESTREAM_ACCESS_KEY_ID=#{Litestream.replica_key_id}"
6
+ puts "LITESTREAM_SECRET_ACCESS_KEY=#{Litestream.replica_access_key}"
12
7
 
13
8
  true
14
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litestream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.11.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Stephen Margheim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logfmt
@@ -38,6 +38,76 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionpack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '7.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '7.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionview
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '7.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '7.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '7.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '7.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activejob
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '7.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '7.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: railties
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '7.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '7.0'
41
111
  - !ruby/object:Gem::Dependency
42
112
  name: rubyzip
43
113
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +165,7 @@ files:
95
165
  - app/controllers/litestream/application_controller.rb
96
166
  - app/controllers/litestream/processes_controller.rb
97
167
  - app/controllers/litestream/restorations_controller.rb
168
+ - app/jobs/litestream/verification_job.rb
98
169
  - app/views/layouts/litestream/_style.html
99
170
  - app/views/layouts/litestream/application.html.erb
100
171
  - app/views/litestream/processes/show.html.erb
@@ -134,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
205
  - !ruby/object:Gem::Version
135
206
  version: '0'
136
207
  requirements: []
137
- rubygems_version: 3.5.17
208
+ rubygems_version: 3.5.11
138
209
  signing_key:
139
210
  specification_version: 4
140
211
  summary: Integrate Litestream with the RubyGems infrastructure.