Skip to content

Commit

Permalink
Merge branch 'main' into v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Impa10r authored Oct 6, 2024
2 parents 60fad60 + 7366ae9 commit 4deb646
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ The process bears no risk to the participants. If any joiner becomes unresponsiv

# Support

Information about PeerSwap and a link to join their Discord channel is at [PeerSwap.dev](https://peerswap.dev). Additionally, there is a [Telegram group](https://t.me/PeerSwapLN) for node runners with PeerSwap. Just beware of scammers who may DM you. Immediately block and report to Telegram anyone with empty Username field.
Join PeerSwap Discord channel at [PeerSwap.dev](https://peerswap.dev).
26 changes: 22 additions & 4 deletions cmd/psweb/config/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,32 @@ func Load(dataDir string, network string) {
} else {
log.Println("Config file created in", Config.DataDir)
}
return
} else {
err = json.Unmarshal(fileData, &Config)
if err != nil {
log.Println("Error unmarshalling config file. Using defaults.")
}
}

err = json.Unmarshal(fileData, &Config)
if err != nil {
log.Println("Error unmarshalling config file. Using defaults.")
// on the first start without pswebconfig.json there will be no elements user and password
if Config.ElementsPass == "" || Config.ElementsUser == "" {
// check in peerswap.conf
Config.ElementsPass = GetPeerswapLNDSetting("elementsd.rpcpass")
Config.ElementsUser = GetPeerswapLNDSetting("elementsd.rpcuser")

// check if they were passed as env
if Config.ElementsUser == "" && os.Getenv("ELEMENTS_USER") != "" {
Config.ElementsUser = os.Getenv("ELEMENTS_USER")
}
if Config.ElementsPass == "" && os.Getenv("ELEMENTS_PASS") != "" {
Config.ElementsPass = os.Getenv("ELEMENTS_PASS")
}
// save changes
Save()
}

// if ElementPass is still empty, this will create temporary peerswap.conf with Liquid disabled
SavePS()
}

// saves PS Web config to pswebconfig.json
Expand Down

0 comments on commit 4deb646

Please sign in to comment.