diff --git a/README.md b/README.md index d66099b8..b7182e1e 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,10 @@ vim .env # edit your config + `JWT_ACCESS_EXPIRY`: How long the access tokens should be valid (in seconds, default 2 days) + `JWT_REFRESH_EXPIRY`: How long the refresh tokens should be valid (in seconds, default 7 days) + `LND_ADDRESS`: LND gRPC address (with port) (e.g. `localhost:10009`) -+ `LND_MACAROON_HEX`: LND macaroon (hex-encoded `admin.macaroon`) -+ `LND_CERT_HEX`: LND certificate (hex-encoded `tls.cert`) ++ `LND_MACAROON_HEX`: LND macaroon (hex-encoded contents of `admin.macaroon` or `lndhub.macaroon`, see below) ++ `LND_MACAROON_FILE`: LND macaroon (provided as path on a filesystem) ++ `LND_CERT_HEX`: LND certificate (hex-encoded contents of `tls.cert`) ++ `LND_CERT_FILE`: LND certificate (provided as path on a filesystem) + `CUSTOM_NAME`: Name used to overwrite the node alias in the getInfo call + `LOG_FILE_PATH`: (optional) By default all logs are written to STDOUT. If you want to log to a file provide the log file path here + `SENTRY_DSN`: (optional) Sentry DSN for exception tracking @@ -68,6 +70,13 @@ Or you bake a new macaroon with the following permissions and use that instead: lncli bakemacaroon info:read invoices:read invoices:write offchain:read offchain:write ``` +If you want to use a macaroon stored on a filesystem, you either set `LND_MACAROON_FILE` to a path pointing to `admin.macaroon` +or use the following command to generate the `lndhub.macaroon` and setting the variable to path of that file. + +``` +lncli bakemacaroon --save_to=lndhub.macaroon info:read invoices:read invoices:write offchain:read offchain:write +``` + ## Developing ```shell diff --git a/lib/service/config.go b/lib/service/config.go index 88774f1f..f181d4f1 100644 --- a/lib/service/config.go +++ b/lib/service/config.go @@ -13,7 +13,9 @@ type Config struct { JWTRefreshTokenExpiry int `envconfig:"JWT_REFRESH_EXPIRY" default:"604800"` // in seconds, default 7 days JWTAccessTokenExpiry int `envconfig:"JWT_ACCESS_EXPIRY" default:"172800"` // in seconds, default 2 days LNDAddress string `envconfig:"LND_ADDRESS" required:"true"` - LNDMacaroonHex string `envconfig:"LND_MACAROON_HEX" required:"true"` + LNDMacaroonFile string `envconfig:"LND_MACAROON_FILE"` + LNDCertFile string `envconfig:"LND_CERT_FILE"` + LNDMacaroonHex string `envconfig:"LND_MACAROON_HEX"` LNDCertHex string `envconfig:"LND_CERT_HEX"` CustomName string `envconfig:"CUSTOM_NAME"` Host string `envconfig:"HOST" default:"localhost:3000"` diff --git a/main.go b/main.go index 54183b71..0a8d45ad 100644 --- a/main.go +++ b/main.go @@ -123,9 +123,11 @@ func main() { // Init new LND client lndClient, err := lnd.NewLNDclient(lnd.LNDoptions{ - Address: c.LNDAddress, - MacaroonHex: c.LNDMacaroonHex, - CertHex: c.LNDCertHex, + Address: c.LNDAddress, + MacaroonFile: c.LNDMacaroonFile, + MacaroonHex: c.LNDMacaroonHex, + CertFile: c.LNDCertFile, + CertHex: c.LNDCertHex, }) if err != nil { e.Logger.Fatalf("Error initializing the LND connection: %v", err)