Use custom chain config
This commit is contained in:
@@ -17,6 +17,10 @@ action :enable do
|
||||
config[:account] = {}
|
||||
config[:account][:password] = ["#{base_path}/password"]
|
||||
|
||||
if config[:parity][:chain] == "dev"
|
||||
config[:parity][:chain] = "#{base_path}/chain-config.json"
|
||||
end
|
||||
|
||||
directory base_path do
|
||||
recursive true
|
||||
owner "parity"
|
||||
@@ -42,8 +46,10 @@ action :enable do
|
||||
|
||||
ruby_block "generate config" do
|
||||
block do
|
||||
parity_args = "--chain #{config[:parity][:chain]} --base-path #{base_path}"
|
||||
|
||||
parity_account_list = Mixlib::ShellOut.new(
|
||||
"parity account list --chain #{config[:parity][:chain]} --base-path #{base_path}",
|
||||
"parity account list #{parity_args}",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_list.run_command
|
||||
@@ -52,7 +58,7 @@ action :enable do
|
||||
|
||||
if parity_account.empty?
|
||||
parity_account_create = Mixlib::ShellOut.new(
|
||||
"parity account new --chain #{config[:parity][:chain]} --base-path #{base_path} --password #{base_path}/password",
|
||||
"parity account new #{parity_args} --password #{base_path}/password",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_create.run_command
|
||||
@@ -62,6 +68,18 @@ action :enable do
|
||||
|
||||
config[:account][:unlock] = [parity_account]
|
||||
|
||||
# Using our own chain config (i.e. dev)
|
||||
if config[:parity][:chain].include?(".json")
|
||||
template "#{base_path}/chain-config.json" do
|
||||
source 'chain-config.json.erb'
|
||||
variables parity_account: parity_account
|
||||
owner "parity"
|
||||
group "parity"
|
||||
mode 0640
|
||||
notifies :restart, "service[#{parity_service}]", :delayed
|
||||
end
|
||||
end
|
||||
|
||||
file "config" do
|
||||
path config_path
|
||||
content TOML::Generator.new(config).body
|
||||
|
||||
Reference in New Issue
Block a user