Conversation
Passing RawMacaroons as a param to LndServicesConfig allows for using macaroon data loaded from files/kubernetes secrets/etc. instead of relying on all macaroons being present in a specific directory. This is especially useful when running in containers or kubernetes pods.
Passing RawTLS allows a user to provide the raw TLS Cert bytes for their LND instance, instead of relying on a hardcoded file/filepath.
252be9c to
448e6be
Compare
|
Thanks for the PR! |
torkelrogstad
left a comment
There was a problem hiding this comment.
Tested that I can connect to LND by passing in []byte values.
I actually like this idea a lot, and would make certain use cases much easier to implement! |
This enables far fewer switch statements, as well as negating the need for a new custom struct type to be passed. The CustomMacaroon parameter expects that the passed Macaroon bytes are either the contents of admin.macaroon, or a self-baked macaroon with all necessary client permissions.
|
@guggero and @torkelrogstad, I just pushed a slight refactor to this PR -- instead of using a self-rolled |
|
Concept ACK, thanks for the changes! The PR needs a rebase. It would also be great if you could clean up the commit structure and split the changes into small and logical commits. There are also a few style nits that should be addressed. |
halseth
left a comment
There was a problem hiding this comment.
Looks pretty good, needs a squash and rebase :)
| default: | ||
| return nil, fmt.Errorf("unsupported network: %v", | ||
| cfg.Network) | ||
| if cfg.CustomMacaroon == nil { |
There was a problem hiding this comment.
style nit: reverse this check, check non-nil path instead
| if cfg.CustomMacaroon == nil { | ||
| var loadMacErr error | ||
|
|
||
| readonlyMac, loadMacErr = loadMacaroon( |
There was a problem hiding this comment.
should move this into the above if
|
Replaced by #51. |
This PR allows an instantiation of LndServicesConfig to use raw macaroon data (passed as bytes or base64-encoded strings) as well as raw TLS certificate data (passed as bytes), allowing for LndServicesConfig to be used programmatically using loaded kubernetes secrets, hardcoded macaroons/certs, etc.
Pull Request Checklist
in
lnd_services.goare updated.