nsq-env 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/nsq-env/consumer.rb +19 -0
- data/lib/nsq-env/producer.rb +17 -0
- data/lib/nsq-env/tls_context.rb +20 -0
- data/lib/nsq-env.rb +7 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 05473fedd6fc898929c32074fcc82ce36970c096
|
4
|
+
data.tar.gz: a10629c320a598562186ab13ab00e01c85bd7073
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b195df2b8add418fdcb27850a112e014a016daf634c52e61409789f2eedcbac3657afe80e7c6293803c2dd7a78b25e34b2f338d4cbe6748d5ab1f3dcb95e088
|
7
|
+
data.tar.gz: 204240da889b1334036d55aaa31ec6d1cefe8a8a3b6e4f93487f234b3f014736239d8e666809239802b8dd9e689f0bf4a00bfd7efbb27d21bb55b783b00db74e
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "krakow"
|
2
|
+
|
3
|
+
module NsqEnv
|
4
|
+
class Consumer < Krakow::Consumer
|
5
|
+
def initialize(opts = {})
|
6
|
+
raise ArgumentError.new "opts should have a :topic key" if not opts[:topic]
|
7
|
+
raise ArgumentError.new "opts should have a :channel key" if not opts[:channel]
|
8
|
+
|
9
|
+
opts.merge!({
|
10
|
+
:nsqlookupd => ENV["NSQLOOKUPD_URLS"].split(","),
|
11
|
+
:max_in_flight => 5,
|
12
|
+
})
|
13
|
+
|
14
|
+
opts.merge! TLSContext.env if ENV["NSQD_TLS"] == "true"
|
15
|
+
|
16
|
+
super(opts)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "krakow"
|
2
|
+
|
3
|
+
module NsqEnv
|
4
|
+
class Producer < Krakow::Producer
|
5
|
+
def initialize(opts = {})
|
6
|
+
raise ArgumentError.new "opts should have a :topic key" if not opts[:topic]
|
7
|
+
|
8
|
+
opts.merge({
|
9
|
+
:host => ENV["NSQD_HOST"],
|
10
|
+
:port => ENV["NSQD_PORT"],
|
11
|
+
})
|
12
|
+
opts.merge! TLSContext.env if ENV["NSQD_TLS"] == "true"
|
13
|
+
|
14
|
+
super(opts)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module NsqEnv
|
2
|
+
class TLSContext
|
3
|
+
def self.env
|
4
|
+
{
|
5
|
+
:connection_options => {
|
6
|
+
:features => {
|
7
|
+
:tls_v1 => true
|
8
|
+
},
|
9
|
+
:config => {
|
10
|
+
:ssl_context => {
|
11
|
+
:ca_file => ENV["NSQD_TLS_CACERT"],
|
12
|
+
:certificate => ENV["NSQD_TLS_CERT"],
|
13
|
+
:key => ENV["NSQD_TLS_KEY"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/nsq-env.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nsq-env
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Léo Unbekandt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: krakow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: celluloid
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.15.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.15.0
|
41
|
+
description: |
|
42
|
+
# Configure NSQ consumers and producers based on Krakow from environment
|
43
|
+
|
44
|
+
## Environment variables
|
45
|
+
|
46
|
+
- `NSQLOOKUPD_URLS` (default to `http://localhost:4161`)
|
47
|
+
- `NSQD_HOST` (default to `localhost`)
|
48
|
+
- `NSQD_PORT` (default to `4150`)
|
49
|
+
- `NSQD_TLS` (default to `false`)
|
50
|
+
- `NSQD_TLS_CERT`
|
51
|
+
- `NSQD_TLS_KEY`
|
52
|
+
email: leo@scalingo.com
|
53
|
+
executables: []
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files: []
|
56
|
+
files:
|
57
|
+
- lib/nsq-env.rb
|
58
|
+
- lib/nsq-env/consumer.rb
|
59
|
+
- lib/nsq-env/producer.rb
|
60
|
+
- lib/nsq-env/tls_context.rb
|
61
|
+
homepage: http://github.com/Scalingo/nsq-env-ruby
|
62
|
+
licenses:
|
63
|
+
- BSD
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.5
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Build consumers and producers with help of environment
|
85
|
+
test_files: []
|