mirror of https://github.com/bumi/lnrpc
Inject macaroon metadata on all grpc calls
This commit is contained in:
parent
e34cd1de00
commit
9ec6414a2b
|
@ -6,11 +6,17 @@ module Lnrpc
|
|||
@macaroon = macaroon_hex
|
||||
end
|
||||
|
||||
def request_response(request:, call:, method:, metadata:)
|
||||
def inject_macaroon_metadata(request:, call:, method:, metadata:)
|
||||
if !metadata.has_key?('macaroon') && !metadata.has_key?(:macaroon)
|
||||
metadata[:macaroon] = @macaroon
|
||||
end
|
||||
yield
|
||||
end
|
||||
|
||||
alias :request_response :inject_macaroon_metadata
|
||||
alias :client_streamer :inject_macaroon_metadata
|
||||
alias :server_streamer :inject_macaroon_metadata
|
||||
alias :bidi_streamer :inject_macaroon_metadata
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue