mirror of https://github.com/bumi/lnrpc
Support credentials as hex value
This commit is contained in:
parent
704c4c9256
commit
2f7ae9202f
|
@ -13,7 +13,8 @@ module Lnrpc
|
|||
self.address = options[:address] || DEFAULT_ADDRESS
|
||||
|
||||
if options.has_key?(:credentials)
|
||||
self.credentials = options[:credentials]
|
||||
# if there are non hex values prvided we assume it's the certificate file as string otherwise we assume it's the hex value
|
||||
self.credentials = options[:credentials].match?(/\H/) ? options[:credentials] : [options[:credentials]].pack('H*')
|
||||
elsif File.exists?(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
|
||||
self.credentials = ::File.read(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue