diff --git a/site-cookbooks/kosmos-bitcoin/attributes/default.rb b/site-cookbooks/kosmos-bitcoin/attributes/default.rb index 4c01630..33fd5ca 100644 --- a/site-cookbooks/kosmos-bitcoin/attributes/default.rb +++ b/site-cookbooks/kosmos-bitcoin/attributes/default.rb @@ -3,7 +3,8 @@ node.default['bitcoin']['checksum'] = '4bbd62fd6acfa5e9864ebf37a24a04bc2dcfe3e3 node.default['bitcoin']['username'] = 'satoshi' node.default['bitcoin']['usergroup'] = 'bitcoin' node.default['bitcoin']['network'] = 'mainnet' -node.default['bitcoin']['datadir'] = '/mnt/data/bitcoin' +node.default['bitcoin']['datadir'] = '/home/satoshi/.bitcoin' +node.default['bitcoin']['walletdir'] = '/mnt/data/bitcoin' node.default['bitcoin']['conf'] = { irc: 1, diff --git a/site-cookbooks/kosmos-bitcoin/recipes/source.rb b/site-cookbooks/kosmos-bitcoin/recipes/source.rb index e3c8e8f..2c32084 100644 --- a/site-cookbooks/kosmos-bitcoin/recipes/source.rb +++ b/site-cookbooks/kosmos-bitcoin/recipes/source.rb @@ -69,10 +69,11 @@ link "/usr/local/bin/bitcoin-cli" do to "/usr/local/bitcoind/src/bitcoin-cli" end -bitcoin_user = node['bitcoin']['username'] -bitcoin_group = node['bitcoin']['usergroup'] -bitcoin_datadir = node['bitcoin']['datadir'] -credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin') +bitcoin_user = node['bitcoin']['username'] +bitcoin_group = node['bitcoin']['usergroup'] +bitcoin_datadir = node['bitcoin']['datadir'] +bitcoin_walletdir = node['bitcoin']['walletdir'] +credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin') group bitcoin_group @@ -82,20 +83,25 @@ user bitcoin_user do shell "/bin/bash" end -directory bitcoin_datadir do - owner bitcoin_user - group bitcoin_group - mode '0750' - recursive true - action :create +[bitcoin_datadir, bitcoin_walletdir].each do |path| + directory path do + owner bitcoin_user + group bitcoin_group + mode '0750' + recursive true + action :create + end end +config = node['bitcoin']['conf'].merge({ + rpcpassword: credentials["rpcpassword"] +}) + template "#{bitcoin_datadir}/bitcoin.conf" do owner bitcoin_user group bitcoin_group mode '0640' - # TODO Create new in data bag and use here - variables conf: node['bitcoin']['conf'].merge({rpcpassword: credentials["rpcpassword"]}), + variables conf: config, mainnet_conf: node['bitcoin']['mainnet_conf'], testnet_conf: node['bitcoin']['testnet_conf'], regtest_conf: node['bitcoin']['regtest_conf']