Skip to content

Commit a4107a9

Browse files
committed
Simplify the getters to not use memoization and fix generator test
1 parent aab4fae commit a4107a9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/litestream.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,27 @@ def verify!(database_path)
6262
# use method instead of attr_accessor to ensure
6363
# this works if variable set after Litestream is loaded
6464
def username
65-
@username ||= ENV["LITESTREAM_USERNAME"] || @@username || "litestream"
65+
ENV["LITESTREAM_USERNAME"] || @@username || "litestream"
6666
end
6767

6868
def password
69-
@password ||= ENV["LITESTREAM_PASSWORD"] || @@password
69+
ENV["LITESTREAM_PASSWORD"] || @@password
7070
end
7171

7272
def queue
73-
@queue ||= ENV["LITESTREAM_QUEUE"] || @@queue || "default"
73+
ENV["LITESTREAM_QUEUE"] || @@queue || "default"
7474
end
7575

7676
def replica_bucket
77-
@replica_bucket ||= @@replica_bucket || configuration.replica_bucket
77+
@@replica_bucket || configuration.replica_bucket
7878
end
7979

8080
def replica_key_id
81-
@replica_key_id ||= @@replica_key_id || configuration.replica_key_id
81+
@@replica_key_id || configuration.replica_key_id
8282
end
8383

8484
def replica_access_key
85-
@replica_access_key ||= @@replica_access_key || configuration.replica_access_key
85+
@@replica_access_key || configuration.replica_access_key
8686
end
8787

8888
def replicate_process

test/generators/test_install.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def after_teardown
2828
end
2929

3030
assert_file "config/initializers/litestream.rb" do |content|
31-
assert_match "config.replica_bucket = litestream_credentials.replica_bucket", content
32-
assert_match "config.replica_key_id = litestream_credentials.replica_key_id", content
33-
assert_match "config.replica_access_key = litestream_credentials.replica_access_key", content
31+
assert_match "config.litestream.replica_bucket = litestream_credentials&.replica_bucket", content
32+
assert_match "config.litestream.replica_key_id = litestream_credentials&.replica_key_id", content
33+
assert_match "config.litestream.replica_access_key = litestream_credentials&.replica_access_key", content
3434
end
3535
end
3636
end

0 commit comments

Comments
 (0)