-
Notifications
You must be signed in to change notification settings - Fork 45
Implement RawTLS and RawMacaroons parameters in LndServicesConfig #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.go
are updated.