rack-lightning 0.1.0 → 0.1.1

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: 5ff9b017989815db3bdcc6041a85792898f0ecc0
4
- data.tar.gz: af955c9b919fa0e1c454bee455f2f2dc2c27b139
3
+ metadata.gz: 84093a3b28a33b94f9dcb0db2f1a85dab9d4000d
4
+ data.tar.gz: 55f1bf66848231e54a51a0d5c3d27b1a38783f25
5
5
  SHA512:
6
- metadata.gz: 39f21da343d431ac1f715de38498873b2e368af24226c9440b85ff87cb7519886a1030cddec2aab4834d170f8da7fc948939479d03423bcbbaff24dec73562d2
7
- data.tar.gz: 85e29afb54ac9a95e1c420ccefaf96535a2b771bcc36b1a362e30d73b58d7ce97fbf320c8ec08050b7008fb7a5ed990a3336c83fe9d0645fe0e92651182a2edb
6
+ metadata.gz: 38a9cf9d3bd3ebbc7c407e09605a949dea750572f43e7b9571c87c184a92a9c7188d613300f7a2c78c328bbf7e26b70a4eaa2686eae26122dbdc3de1682c2d9f
7
+ data.tar.gz: 3a83eee6a8e10b815b364f6a1ceda7050b92c4d4481e27515643fcdef912bb7ed7cd53a1a139ceb2a21d7767b158083ed6ac3762a19e09db4f08c234548e564c
data/README.md CHANGED
@@ -51,6 +51,25 @@ The middleware accepts the following configuration options:
51
51
  * `address`: the address of the lnd gRPC service( default: localhost:10009)
52
52
  * `credentials_path`: path to the tls.cert (default: ~/.lnd/tls.cert)
53
53
  * `macaroon_path`: path to the macaroon path (default: ~/.lnd/data/chain/bitcoin/testnet/admin.macaroon)
54
+ * `credentials`: instead of configuring a `credentials_path` you can pass the content of the tls.cert directly
55
+ * `macaroon`: instead of configuring a `macaroon_path` you can pass the hex content of the macaroon directly
56
+
57
+ ### How to pass credentials or macaroon data from a variable like a environment varibale?
58
+
59
+ The tls.cert and the macaroon config can be loaded from a variable:
60
+
61
+ ```ruby
62
+ ENV['LND_CREDENTIALS'] = "the content of your tls.cert file"
63
+ ENV['LND_MACAROON'] = "the hex encoded content of your macaroon file"
64
+ # you can get the macaroon content like this:
65
+ # ::File.read(::File.expand_path("/path/to/admin.macaroon")).each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join
66
+
67
+ Example = Rack::Builder.new {
68
+ use Rack::Lightning, { macaroon: ENV['LND_MACAROON'], credentials: ENV['LND_CREDENTIALS'] }
69
+ run Proc.new { |env| ['200', {'Content-Type' => 'text/html'}, ['get rack\'d']] }
70
+ }.to_app
71
+ ```
72
+
54
73
 
55
74
  ## What is the Lightning Network?
56
75
 
@@ -14,8 +14,10 @@ module Rack
14
14
  @options[:address] ||= 'localhost:10009'
15
15
  @options[:timeout] ||= 5
16
16
  @options[:credentials] ||= ::File.read(::File.expand_path(@options[:credentials_path] || "~/.lnd/tls.cert"))
17
- macaroon_binary ||= ::File.read(::File.expand_path(@options[:macaroon_path] || "~/.lnd/data/chain/bitcoin/testnet/admin.macaroon"))
18
- @options[:macaroon] = macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join
17
+ @options[:macaroon] ||= begin
18
+ macaroon_binary = ::File.read(::File.expand_path(@options[:macaroon_path] || "~/.lnd/data/chain/bitcoin/testnet/admin.macaroon"))
19
+ macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join
20
+ end
19
21
  @lnd_client = Lnrpc::Lightning::Stub.new(@options[:address], GRPC::Core::ChannelCredentials.new(@options[:credentials]))
20
22
  end
21
23
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Lightning
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-lightning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bumi