feat: Update configuration storage and overrides
All checks were successful
Build Docker / Build Image (push) Successful in 53s
All checks were successful
Build Docker / Build Image (push) Successful in 53s
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ dist/
|
|||||||
hsd/
|
hsd/
|
||||||
hsd-data/
|
hsd-data/
|
||||||
hsd.lock
|
hsd.lock
|
||||||
|
hsdconfig.json
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -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
|
## Warnings
|
||||||
|
|
||||||
- This is a work in progress and is not guaranteed to work
|
- This is a work in progress and is not guaranteed to work
|
||||||
|
|||||||
30
account.py
30
account.py
@@ -48,18 +48,25 @@ if SHOW_EXPIRED is None:
|
|||||||
HSD_PROCESS = None
|
HSD_PROCESS = None
|
||||||
|
|
||||||
# Get hsdconfig.json
|
# 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'):
|
if not os.path.exists('hsdconfig.json'):
|
||||||
# Pull from the latest git
|
with open('hsdconfig.json', 'w') as f:
|
||||||
response = requests.get("https://git.woodburn.au/nathanwoodburn/firewalletbrowser/raw/branch/main/hsdconfig.json")
|
f.write(json.dumps(HSD_CONFIG, indent=4))
|
||||||
if response.status_code == 200:
|
|
||||||
with open('hsdconfig.json', 'w') as f:
|
|
||||||
f.write(response.text)
|
|
||||||
HSD_CONFIG = response.json()
|
|
||||||
else:
|
else:
|
||||||
with open('hsdconfig.json') as f:
|
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)
|
hsd = api.hsd(HSD_API, HSD_IP, HSD_NODE_PORT)
|
||||||
hsw = api.hsw(HSD_API, HSD_IP, HSD_WALLET_PORT)
|
hsw = api.hsw(HSD_API, HSD_IP, HSD_WALLET_PORT)
|
||||||
@@ -1634,7 +1641,6 @@ def hsdStart():
|
|||||||
f"--network={HSD_NETWORK}",
|
f"--network={HSD_NETWORK}",
|
||||||
f"--prefix={prefix}",
|
f"--prefix={prefix}",
|
||||||
f"--api-key={HSD_API}",
|
f"--api-key={HSD_API}",
|
||||||
"--agent=FireWallet",
|
|
||||||
"--http-host=127.0.0.1",
|
"--http-host=127.0.0.1",
|
||||||
"--log-console=false"
|
"--log-console=false"
|
||||||
]
|
]
|
||||||
@@ -1647,6 +1653,10 @@ def hsdStart():
|
|||||||
if spv:
|
if spv:
|
||||||
cmd.append("--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
|
# Launch process
|
||||||
HSD_PROCESS = subprocess.Popen(
|
HSD_PROCESS = subprocess.Popen(
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v8.0.0",
|
|
||||||
"chainMigrate":4,
|
|
||||||
"walletMigrate":7,
|
|
||||||
"minNodeVersion":20,
|
|
||||||
"minNpmVersion":8,
|
|
||||||
"spv": true
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user