mirror of
https://github.com/bumi/lntip
synced 2025-06-16 09:45:35 +00:00
Make Tor executable configurable
It seems the `tor` executable is not in the $PATH on heroku and thus needs to be configurable.
This commit is contained in:
parent
36d4dec5fd
commit
324d5b3b43
4
app.json
4
app.json
@ -16,6 +16,10 @@
|
|||||||
"LNME_LND_CERT": {
|
"LNME_LND_CERT": {
|
||||||
"description": "LND TLS cert as HEX",
|
"description": "LND TLS cert as HEX",
|
||||||
"value": ""
|
"value": ""
|
||||||
|
},
|
||||||
|
"LNME_TOR_EXE_PATH": {
|
||||||
|
"description": "Path to the tor executable",
|
||||||
|
"value": "~/tor/bin/tor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"buildpacks": [
|
"buildpacks": [
|
||||||
|
@ -37,6 +37,7 @@ type LNDoptions struct {
|
|||||||
CertHex string
|
CertHex string
|
||||||
MacaroonFile string
|
MacaroonFile string
|
||||||
MacaroonHex string
|
MacaroonHex string
|
||||||
|
TorExePath string // used when connecting through tor to LND
|
||||||
}
|
}
|
||||||
|
|
||||||
type LNDclient struct {
|
type LNDclient struct {
|
||||||
@ -138,7 +139,7 @@ func NewLNDclient(lndOptions LNDoptions) (LNDclient, error) {
|
|||||||
|
|
||||||
if strings.Contains(lndOptions.Address, ".onion") {
|
if strings.Contains(lndOptions.Address, ".onion") {
|
||||||
// Start Tor
|
// Start Tor
|
||||||
t, err := tor.Start(nil, nil)
|
t, err := tor.Start(nil, &tor.StartConf{ExePath: lndOptions.TorExePath})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
2
lnme.go
2
lnme.go
@ -94,6 +94,7 @@ func main() {
|
|||||||
CertHex: cfg.String("lnd-cert"),
|
CertHex: cfg.String("lnd-cert"),
|
||||||
MacaroonFile: cfg.String("lnd-macaroon-path"),
|
MacaroonFile: cfg.String("lnd-macaroon-path"),
|
||||||
MacaroonHex: cfg.String("lnd-macaroon"),
|
MacaroonHex: cfg.String("lnd-macaroon"),
|
||||||
|
TorExePath: cfg.String("tor-exe-path"),
|
||||||
}
|
}
|
||||||
lnClient, err := ln.NewLNDclient(lndOptions)
|
lnClient, err := ln.NewLNDclient(lndOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -228,6 +229,7 @@ func LoadConfig() *koanf.Koanf {
|
|||||||
f.String("static-path", "", "Path to a static assets directory.")
|
f.String("static-path", "", "Path to a static assets directory.")
|
||||||
f.String("port", "", "Port to bind on (deprecated - use listen).")
|
f.String("port", "", "Port to bind on (deprecated - use listen).")
|
||||||
f.String("listen", "", fmt.Sprintf("Address to bind on. (default \"%s\")", DEFAULT_LISTEN))
|
f.String("listen", "", fmt.Sprintf("Address to bind on. (default \"%s\")", DEFAULT_LISTEN))
|
||||||
|
f.String("tor-exe-path", "tor", "Path to the Tor executable. Used when connecting through Tor. (default: tor)")
|
||||||
var configPath string
|
var configPath string
|
||||||
f.StringVar(&configPath, "config", "config.toml", "Path to a .toml config file.")
|
f.StringVar(&configPath, "config", "config.toml", "Path to a .toml config file.")
|
||||||
f.Parse(os.Args[1:])
|
f.Parse(os.Args[1:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user