feat: Update configuration storage and overrides
All checks were successful
Build Docker / Build Image (push) Successful in 53s

This commit is contained in:
2025-08-26 18:04:07 +10:00
parent 7fdc4a3122
commit 26c5b4a4fa
4 changed files with 35 additions and 18 deletions

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ dist/
hsd/
hsd-data/
hsd.lock
hsdconfig.json

View File

@@ -129,6 +129,20 @@ INTERNAL_HSD: Use internal HSD node (true/false)
```
# Internal HSD
If you set INTERNAL_HSD=true in the .env file the wallet will start and manage its own HSD node. If you want to override the default HSD config create a file called hsdconfig.json in the same directory as main.py and change the values you want to override. For example to disable SPV and use an existing bob wallet sync (on linux) and set the agent to "SuperCoolDev" you could use the following:
```json
{
"spv": false,
"prefix":"~/.config/Bob/hsd_data",
"flags":[
"--agent=SuperCoolDev"
]
}
```
## Warnings
- This is a work in progress and is not guaranteed to work

View File

@@ -48,18 +48,25 @@ if SHOW_EXPIRED is None:
HSD_PROCESS = None
# Get hsdconfig.json
HSD_CONFIG = {}
HSD_CONFIG = {
"version": "v8.0.0",
"chainMigrate": 4,
"walletMigrate": 7,
"minNodeVersion": 20,
"minNpmVersion": 8,
"spv": False,
"flags": [
"--agent=FireWallet"
]
}
if not os.path.exists('hsdconfig.json'):
# Pull from the latest git
response = requests.get("https://git.woodburn.au/nathanwoodburn/firewalletbrowser/raw/branch/main/hsdconfig.json")
if response.status_code == 200:
with open('hsdconfig.json', 'w') as f:
f.write(response.text)
HSD_CONFIG = response.json()
f.write(json.dumps(HSD_CONFIG, indent=4))
else:
with open('hsdconfig.json') as f:
HSD_CONFIG = json.load(f)
hsdConfigTMP = json.load(f)
for key in hsdConfigTMP:
HSD_CONFIG[key] = hsdConfigTMP[key]
hsd = api.hsd(HSD_API, HSD_IP, HSD_NODE_PORT)
hsw = api.hsw(HSD_API, HSD_IP, HSD_WALLET_PORT)
@@ -1634,7 +1641,6 @@ def hsdStart():
f"--network={HSD_NETWORK}",
f"--prefix={prefix}",
f"--api-key={HSD_API}",
"--agent=FireWallet",
"--http-host=127.0.0.1",
"--log-console=false"
]
@@ -1647,6 +1653,10 @@ def hsdStart():
if spv:
cmd.append("--spv")
# Add flags
if len(HSD_CONFIG.get("flags",[])) > 0:
for flag in HSD_CONFIG.get("flags",[]):
cmd.append(flag)
# Launch process
HSD_PROCESS = subprocess.Popen(

View File

@@ -1,8 +0,0 @@
{
"version": "v8.0.0",
"chainMigrate":4,
"walletMigrate":7,
"minNodeVersion":20,
"minNpmVersion":8,
"spv": true
}