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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b7b0c443abcda1f4e01355aa2102e53b8560216
4
- data.tar.gz: c4a1a0edb4d41ebc0d4ef938315afb9fcae15738
3
+ metadata.gz: fc1c486ed7bc7f2d149a712b662e54318d7dd1c1
4
+ data.tar.gz: 411fb7a933d1ddb2e5fcefb2a341caae79d42893
5
5
  SHA512:
6
- metadata.gz: 9c0c2d97c4ad9c35ec67c506c96dd13bf19e956e633079cb7641b85d4a5a85492b0db55a0b263adaef5c737b7644fa71e098ce2a8bbe0ef064a74d5abf72084b
7
- data.tar.gz: cd38ce21911ab087193711e8c6bc3d95472c43b34bc57e3b66c9e39b3e1d86cec283cf83dd9c15d3f863f72c2828d868a9d190ba35e8eb97609cb00e8bb8ae52
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 the `REDIS_URL` environment variable. By default it will connect to `redis://localhost:6379`.
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dogtag
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
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.1.2
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-17 00:00:00.000000000 Z
11
+ date: 2017-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis