1
0
mirror of https://github.com/bumi/lnrpc synced 2024-06-05 13:49:08 +00:00

Inject macaroon metadata on all grpc calls

This commit is contained in:
bumi 2019-02-19 16:08:31 +01:00
parent e34cd1de00
commit 9ec6414a2b

View File

@ -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