Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/service/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down