tiny-redis 0.0.12 → 0.0.13

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: a3c3bcffcac3db520b0ebd410502ae66d32b94f07f5491ff13476988ec1cd9fd
4
- data.tar.gz: 813793cec558b3c6800d79e27a7d30ee0f96f65aa73215639092f386424d0058
3
+ metadata.gz: 7d027f2a5a16f37ee213f2fb5bbf6cc9cfeab6e2f734c3982eca4a0cd4f357df
4
+ data.tar.gz: b8afbbedebb2c78b5497cc2f13dc2bc5d5757fe3b274b57f9c340857bf98c2bf
5
5
  SHA512:
6
- metadata.gz: a2a6c54e535a422971eef2def1d814885c101e1ef6d47c7fd983003a63ba7a0317367cfb9265438f5ec877effb44a85df8b89c368b32c740e808520d61ddc747
7
- data.tar.gz: 822f019b23e9d59254475aabe26394e47f8afeb3f58520779727f25e69bf297456f11a3a9a7d67d58a6f62c1b8a89feb8e082ffc8bcce247bdc626364b60dae5
6
+ metadata.gz: 10a6cab1de4d76f20e9a53f9dbb22a3714c4444e3f806d1a72fd1454116b1415c2c040784f246879d7273713767a6f2ee429c8a2100ab47a66a8044176dca80a
7
+ data.tar.gz: 52dff9c8552d0cae2f87cbbffeb93342951f5a89e732f7397cedd51a4557c7bfd56faea9957a17f94d3bc8c162331e38a873d13c18c79691ce0c54f1f2b47fa6
data/README.md CHANGED
@@ -33,6 +33,12 @@ Set up credentials:
33
33
  user:
34
34
  encryptkey: abcdabcdabcdadbvabcdabcdabcdadbv
35
35
  ```
36
+ ##Env Vars
37
+ ```
38
+ RAILS_MAX_CONCURRENCY - how many connections will be created to redis server
39
+ REDIS_TIMEOUT - timeout for operations
40
+ REDIS_URL - url for redis server.
41
+ ```
36
42
 
37
43
  Now your records in redis are encrypted. If you wish for more security you can remove config/master.key after server starts. And investigate SE Linux address space protection so hacker can't pry encryption key from the app so easily.
38
44
 
@@ -1,11 +1,21 @@
1
1
  class TinyRedisGenerator < Rails::Generators::Base
2
2
  def create_tiny_redis_file
3
3
  create_file "config/initializers/tiny-redis.rb", <<EOD
4
+ concurrency = Env.fetch(:RAILS_MAX_CONCURRENCY) {5}
5
+ timeout = Env.fetch(:REDIS_TIMEOUT) {1}
6
+ url = Env.fetch(:REDIS_URL){
7
+ if Rails.env.test?
8
+ "redis://127.0.0.1:6379/2"
9
+ else
10
+ "redis://127.0.0.1:6379/1"
11
+ end
12
+ }
13
+
4
14
  if Rails.env.test?
5
- $redis = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis.new(url: 'redis://127.0.0.1:6379/2') }
15
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url }
6
16
  $redis.flushall
7
17
  else
8
- $redis = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis.new(url: 'redis://127.0.0.1:6379/1') }
18
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url }
9
19
  end
10
20
  EOD
11
21
  end
@@ -1,5 +1,5 @@
1
1
  module Tiny
2
2
  module Redis
3
- VERSION = '0.0.12'
3
+ VERSION = '0.0.13'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Zaitsev