tiny-redis 0.0.7 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -18
- data/lib/generators/tiny_redis_generator.rb +12 -0
- data/lib/tiny/redis/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3c3bcffcac3db520b0ebd410502ae66d32b94f07f5491ff13476988ec1cd9fd
|
4
|
+
data.tar.gz: 813793cec558b3c6800d79e27a7d30ee0f96f65aa73215639092f386424d0058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2a6c54e535a422971eef2def1d814885c101e1ef6d47c7fd983003a63ba7a0317367cfb9265438f5ec877effb44a85df8b89c368b32c740e808520d61ddc747
|
7
|
+
data.tar.gz: 822f019b23e9d59254475aabe26394e47f8afeb3f58520779727f25e69bf297456f11a3a9a7d67d58a6f62c1b8a89feb8e082ffc8bcce247bdc626364b60dae5
|
data/README.md
CHANGED
@@ -1,28 +1,39 @@
|
|
1
|
-
|
2
|
-
Short description and motivation.
|
1
|
+
### tiny-redis
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
Tiny Redis - encrypted barebones JSON formatted orm.
|
4
|
+
Encryption is Rails Credentials based.
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
Steps to use:
|
7
|
+
```
|
8
|
+
add to Gemfile:
|
9
|
+
gem 'tiny-redis'
|
10
|
+
|
11
|
+
bundle install
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
rails g tiny_redis
|
14
|
+
|
15
|
+
this will install initalizer that creates a pool of redis connections
|
12
16
|
```
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
## How to use
|
19
|
+
|
20
|
+
```
|
21
|
+
class User
|
22
|
+
include Tiny::Redis
|
23
|
+
|
24
|
+
attr_accessor :email
|
25
|
+
alias_method :index, :email # this will tie your records method to indexing parameter
|
26
|
+
end
|
27
|
+
```
|
28
|
+
Set up credentials:
|
17
29
|
```
|
30
|
+
rails credentials:edit --environment development
|
18
31
|
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
add:
|
33
|
+
user:
|
34
|
+
encryptkey: abcdabcdabcdadbvabcdabcdabcdadbv
|
22
35
|
```
|
23
36
|
|
24
|
-
|
25
|
-
Contribution directions go here.
|
37
|
+
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.
|
26
38
|
|
27
|
-
|
28
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
39
|
+
Have fun! 🎉
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class TinyRedisGenerator < Rails::Generators::Base
|
2
|
+
def create_tiny_redis_file
|
3
|
+
create_file "config/initializers/tiny-redis.rb", <<EOD
|
4
|
+
if Rails.env.test?
|
5
|
+
$redis = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis.new(url: 'redis://127.0.0.1:6379/2') }
|
6
|
+
$redis.flushall
|
7
|
+
else
|
8
|
+
$redis = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis.new(url: 'redis://127.0.0.1:6379/1') }
|
9
|
+
end
|
10
|
+
EOD
|
11
|
+
end
|
12
|
+
end
|
data/lib/tiny/redis/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.12
|
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-
|
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
|