tiny-redis 0.0.10 → 0.0.15

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: '0009cb8d3b8735df40e25713bf00f85add989605647bf90db19f2f28c2a1a3e9'
4
- data.tar.gz: 68a7a0e6b62f7bbaa0a6f1627df34c380530dbe64991e8f749177e3f50f074aa
3
+ metadata.gz: 449e819a927222ab4394a981104b7af7fc965fcdb1f11b207a838ae666db9aa8
4
+ data.tar.gz: 1d158b9f6dbc695931ccd04de43b1eb959830b55c8c849b542e4987b83f3c570
5
5
  SHA512:
6
- metadata.gz: a39bb0c3ad4640544e465f37151569ad3e863c621f18e417342863b6242daace46a424c30cfb851d86dd7e90cf44b0a0e5c52fe4736e965fb816fc908ad71e1c
7
- data.tar.gz: 722cba22575aa63184a589ce8496a219f755e2d9db7ec8a3922f6d2dcd09d66ba58615a6ad6d0364bd074d8abb3b43ad8035ebab86eb2a10db313c0ea0fede2f
6
+ metadata.gz: c1842798068540f6faa58f6432a1e846e330c9f503f087fb2d7ba34f9a7b0514565f8a3381f0695cbeb3c56741a8faa2dd7193372ac5e128d872ad3ced5c63cb
7
+ data.tar.gz: 3260e71d127d5248f0bac018fe8a66798df1dc63fee472a4f99ca7906eb18048c4d527c8a17ebbaf9d01ed7b31618020ec22c4d9d6b4db78b06640e39357e821
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
 
@@ -0,0 +1,23 @@
1
+ class TinyRedisGenerator < Rails::Generators::Base
2
+ def create_tiny_redis_file
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
+
7
+ url = ENV.fetch("REDIS_URL"){
8
+ if Rails.env.test?
9
+ "redis://127.0.0.1:6379/2"
10
+ else
11
+ "redis://127.0.0.1:6379/1"
12
+ end
13
+ }
14
+
15
+ if Rails.env.test?
16
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url )}
17
+ $redis.flushall
18
+ else
19
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url )}
20
+ end
21
+ EOD
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module Tiny
2
2
  module Redis
3
- VERSION = '0.0.10'
3
+ VERSION = '0.0.15'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Zaitsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-28 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -68,6 +68,7 @@ files:
68
68
  - MIT-LICENSE
69
69
  - README.md
70
70
  - Rakefile
71
+ - lib/generators/tiny_redis_generator.rb
71
72
  - lib/tasks/tiny/redis_tasks.rake
72
73
  - lib/tiny/redis.rb
73
74
  - lib/tiny/redis/railtie.rb