Improve Specter auto-config (run once)

This commit is contained in:
Taylor Helsper 2021-06-03 23:01:19 -05:00
parent 47a96dedd0
commit 9fe8d16251
4 changed files with 22 additions and 16 deletions

View File

@ -9,7 +9,7 @@ After=bitcoin.service
[Service] [Service]
ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/mynode_gen_cert.sh specter 825 ExecStartPre=/usr/bin/mynode_gen_cert.sh specter 825
#ExecStartPre=/usr/bin/mynode_pre_specter.sh ExecStartPre=/usr/bin/mynode_pre_specter.sh
WorkingDirectory=/opt/mynode/specter WorkingDirectory=/opt/mynode/specter
ExecStart=/opt/mynode/specter/env/bin/python3 -m cryptoadvance.specter server --host 0.0.0.0 --cert=/mnt/hdd/mynode/settings/specter/myNode.local.crt --key=/mnt/hdd/mynode/settings/specter/myNode.local.key ExecStart=/opt/mynode/specter/env/bin/python3 -m cryptoadvance.specter server --host 0.0.0.0 --cert=/mnt/hdd/mynode/settings/specter/myNode.local.crt --key=/mnt/hdd/mynode/settings/specter/myNode.local.key

View File

@ -0,0 +1,9 @@
#!/bin/bash
source /usr/share/mynode/mynode_config.sh
set -x
if [ ! -f /mnt/hdd/mynode/specter/config.json ]; then
cp -f /usr/share/mynode/specter.conf /mnt/hdd/mynode/specter/config.json
fi

View File

@ -421,22 +421,7 @@ if [ ! -L /home/bitcoin/.specter ]; then
# Setup symlink to HDD # Setup symlink to HDD
sudo -u bitcoin ln -s /mnt/hdd/mynode/specter /home/bitcoin/.specter sudo -u bitcoin ln -s /mnt/hdd/mynode/specter /home/bitcoin/.specter
fi fi
if [ -f /mnt/hdd/mynode/specter/config.json ]; then
# Setup config file to point to local bitcoin instance
BTCRPCPW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw)
# Update Specter Settings
set +e
# cat /mnt/hdd/mynode/specter/config.json | jq '.rpc.datadir = "/home/bitcoin/.bitcoin"' > /mnt/hdd/mynode/specter/config_temp.json
# cp -f /mnt/hdd/mynode/specter/config_temp.json /mnt/hdd/mynode/specter/config.json
cat /mnt/hdd/mynode/specter/config.json | jq '.rpc.user = "mynode"' > /mnt/hdd/mynode/specter/config_temp.json
cp -f /mnt/hdd/mynode/specter/config_temp.json /mnt/hdd/mynode/specter/config.json
cat /mnt/hdd/mynode/specter/config.json | jq ".rpc.password = \"$BTCRPCPW\"" > /mnt/hdd/mynode/specter/config_temp.json
cp -f /mnt/hdd/mynode/specter/config_temp.json /mnt/hdd/mynode/specter/config.json
cat /mnt/hdd/mynode/specter/config.json | jq '.rpc.port = "8332"' > /mnt/hdd/mynode/specter/config_temp.json
cp -f /mnt/hdd/mynode/specter/config_temp.json /mnt/hdd/mynode/specter/config.json
set -e
fi
# Setup Thunderhub # Setup Thunderhub
mkdir -p /mnt/hdd/mynode/thunderhub/ mkdir -p /mnt/hdd/mynode/thunderhub/

View File

@ -0,0 +1,12 @@
{
"rpc": {
"autodetect": true,
"datadir": "/home/bitcoin/.bitcoin",
"user": "mynode",
"password": "",
"port": "8332",
"host": "localhost",
"protocol": "http",
"external_node": true
}
}