lnd+macaroons: specify location when creating macaroon service

To allow the macaroon service to be used in other projects, we want the
location to be passed in as a parameter instead of being hard coded.
This commit is contained in:
Oliver Gugger committed 2020-09-10 10:24:08 +02:00
1 parent 8668248d96
commit d4c4cf01f0
3 files changed
+15 -7

No files matched your search

+2 -2
View File
@@ -54,7 +54,7 @@ type Service struct {
// listing the same checker more than once is not harmful. Default checkers,
// such as those for `allow`, `time-before`, `declared`, and `error` caveats
// are registered automatically and don't need to be added.
func NewService(dir string, checks ...Checker) (*Service, error) {
func NewService(dir, location string, checks ...Checker) (*Service, error) {
// Ensure that the path to the directory exists.
if _, err := os.Stat(dir); os.IsNotExist(err) {
if err := os.MkdirAll(dir, 0700); err != nil {
@@ -77,7 +77,7 @@ func NewService(dir string, checks ...Checker) (*Service, error) {
}
macaroonParams := bakery.BakeryParams{
Location: "lnd",
Location: location,
RootKeyStore: rootKeyStore,
// No third-party caveat support for now.
// TODO(aakselrod): Add third-party caveat support.