only update bitcoin.conf when changed
This commit is contained in:
parent
08322eed9b
commit
3e188238d0
@ -253,12 +253,14 @@ in {
|
|||||||
if [[ ! -e ${cfg.dataDir}/blocks ]]; then
|
if [[ ! -e ${cfg.dataDir}/blocks ]]; then
|
||||||
mkdir -m 0770 -p '${cfg.dataDir}/blocks'
|
mkdir -m 0770 -p '${cfg.dataDir}/blocks'
|
||||||
fi
|
fi
|
||||||
|
chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}'
|
||||||
chmod -R g+rX '${cfg.dataDir}/blocks'
|
chmod -R g+rX '${cfg.dataDir}/blocks'
|
||||||
|
|
||||||
cp '${configFile}' '${cfg.dataDir}/bitcoin.conf'
|
cfg=$(cat ${configFile}; printf "rpcpassword="; cat "${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword")
|
||||||
chmod o-rw '${cfg.dataDir}/bitcoin.conf'
|
confFile='${cfg.dataDir}/bitcoin.conf'
|
||||||
chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}'
|
if [[ ! -e $confFile || $cfg != $(cat $confFile) ]]; then
|
||||||
echo "rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword)" >> '${cfg.dataDir}/bitcoin.conf'
|
install -o '${cfg.user}' -g '${cfg.group}' -m 640 <(echo "$cfg") $confFile
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
# Wait until RPC port is open. This usually takes just a few ms.
|
# Wait until RPC port is open. This usually takes just a few ms.
|
||||||
postStart = ''
|
postStart = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user