dogtag 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/dogtag/mixins/redis.rb +5 -1
- data/lib/dogtag/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc1c486ed7bc7f2d149a712b662e54318d7dd1c1
|
4
|
+
data.tar.gz: 411fb7a933d1ddb2e5fcefb2a341caae79d42893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5af3d85d8dc0596de7666725fbf24e734d05ad1ff6d4b32103e59f51a3bbf6a1a9d3325adcf32c61ae9f96699e9bb60ec434f1f1d8f05bb7c14245ff56ab5a61
|
7
|
+
data.tar.gz: 98002f29bcd79b377c6bdbb3cfb704780d208b010fa35f8b3dd360f1f39221f6fcca29035cc19dc48b400dd2c558a32186c6eff48d827109b7a2a8acc16bfef7
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Simply add `gem 'dogtag'` to your `Gemfile` and run `bundle`
|
|
16
16
|
Configuration
|
17
17
|
-------------
|
18
18
|
|
19
|
-
To configure the connection to your Redis server simply set
|
19
|
+
To configure the connection to your Redis server simply set a `DOGTAG_REDIS_URL` or `REDIS_URL` environment variable. Dogtag will first look for the `DOGTAG_REDIS_URL`, then `REDIS_URL`. If neither are found it will default to `redis://localhost:6379`.
|
20
20
|
|
21
21
|
To set the range of logical shard IDs this server should manage, run the command below replacing the number range with a range of numbers, of which none can be shared with another Redis server. If a logical shard ID is shared a separate Redis instance, you may get ID collisions.
|
22
22
|
|
@@ -42,10 +42,21 @@ Dogtag.generate_id data_type, count
|
|
42
42
|
|
43
43
|
*Note: The available data type ID numbers are current 0 - 255.*
|
44
44
|
|
45
|
+
Gotchas
|
46
|
+
-------
|
47
|
+
|
48
|
+
- If you are going to store the ID in the database you'll need to make sure it can store 64 bit integers. In [Rails](http://rubyonrails.org/) this means using `integer` `limit: 8` in your migrations.
|
49
|
+
- Be careful of using Dogtag IDs with JavaScript, since it [doesn't handle 64 bit integers well](http://stackoverflow.com/questions/9643626/javascript-cant-handle-64-bit-integers-can-it). You'll probably want to work with them as strings.
|
50
|
+
|
45
51
|
Related Projects
|
46
52
|
----------------
|
47
53
|
- __[dogtag-web](https://github.com/zillyinc/dogtag-web)__ - Web API for dogtag
|
48
54
|
|
55
|
+
Testing
|
56
|
+
-------
|
57
|
+
|
58
|
+
Simply spin up a Redis server and run `bundle exec rspec`.
|
59
|
+
|
49
60
|
TODO
|
50
61
|
----
|
51
62
|
- Support multiple Redis servers
|
data/lib/dogtag/mixins/redis.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Dogtag
|
2
2
|
module Mixins
|
3
3
|
module Redis
|
4
|
+
DEFAULT_REDIS_URL = 'redis://localhost:6379'.freeze
|
5
|
+
|
4
6
|
def redis
|
5
7
|
# TODO: Redis config for multiple servers
|
6
|
-
@redis ||= ::Redis.new
|
8
|
+
@redis ||= ::Redis.new(
|
9
|
+
url: ENV['DOGTAG_REDIS_URL'] || ENV['REDIS_URL'] || DEFAULT_REDIS_URL
|
10
|
+
)
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/dogtag/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogtag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Crownoble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|