Generate the config files using a TOML parser
Now we don't need to change both the template and the resources to add options
This commit is contained in:
parent
462e7ff858
commit
e2b483eb3f
@ -6,4 +6,6 @@ description 'Installs/Configures kosmos-parity'
|
|||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version '0.1.0'
|
version '0.1.0'
|
||||||
|
|
||||||
|
gem 'toml'
|
||||||
|
|
||||||
depends 'ark'
|
depends 'ark'
|
||||||
|
@ -33,25 +33,55 @@ dpkg_package "parity" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
parity_node "dev" do
|
parity_node "dev" do
|
||||||
config chain: "dev",
|
config parity: {
|
||||||
network_port: 30303,
|
chain: "dev",
|
||||||
json_rpc_port: 8545,
|
},
|
||||||
dapps_port: 8090,
|
network: {
|
||||||
ui_port: 8180
|
port: 30303,
|
||||||
|
},
|
||||||
|
rpc: {
|
||||||
|
port: 8545,
|
||||||
|
},
|
||||||
|
dapps: {
|
||||||
|
port: 8090,
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
port: 8180,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
parity_node "testnet" do
|
parity_node "testnet" do
|
||||||
config chain: "ropsten",
|
config parity: {
|
||||||
network_port: 30304,
|
chain: "ropsten",
|
||||||
json_rpc_port: 8546,
|
},
|
||||||
dapps_port: 8091,
|
network: {
|
||||||
ui_port: 8181
|
port: 30304,
|
||||||
|
},
|
||||||
|
rpc: {
|
||||||
|
port: 8546,
|
||||||
|
},
|
||||||
|
dapps: {
|
||||||
|
port: 8091,
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
port: 8181,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
parity_node "mainnet" do
|
parity_node "mainnet" do
|
||||||
config chain: "homestead",
|
config parity: {
|
||||||
network_port: 30305,
|
chain: "homestead",
|
||||||
json_rpc_port: 8547,
|
},
|
||||||
dapps_port: 8092,
|
network: {
|
||||||
ui_port: 8182
|
port: 30305,
|
||||||
|
},
|
||||||
|
rpc: {
|
||||||
|
port: 8547,
|
||||||
|
},
|
||||||
|
dapps: {
|
||||||
|
port: 8092,
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
port: 8182,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require 'toml'
|
||||||
|
|
||||||
provides :parity_node
|
provides :parity_node
|
||||||
|
|
||||||
property :name, String, name_property: true
|
property :name, String, name_property: true
|
||||||
@ -7,6 +9,7 @@ action :enable do
|
|||||||
node_name = name
|
node_name = name
|
||||||
|
|
||||||
base_path = "#{node['kosmos-parity']['home_path']}/.local/share/io.parity.ethereum/#{name}"
|
base_path = "#{node['kosmos-parity']['home_path']}/.local/share/io.parity.ethereum/#{name}"
|
||||||
|
config[:parity][:base_path] = base_path
|
||||||
|
|
||||||
directory base_path do
|
directory base_path do
|
||||||
recursive true
|
recursive true
|
||||||
@ -24,11 +27,10 @@ action :enable do
|
|||||||
|
|
||||||
config_file = "#{base_path}/config.toml"
|
config_file = "#{base_path}/config.toml"
|
||||||
|
|
||||||
template config_file do
|
file config_file do
|
||||||
source "config.toml.erb"
|
content TOML::Generator.new(config).body
|
||||||
owner "parity"
|
owner "parity"
|
||||||
group "parity"
|
group "parity"
|
||||||
variables config.merge(base_path: base_path)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
execute "systemctl daemon-reload" do
|
execute "systemctl daemon-reload" do
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
[parity]
|
|
||||||
chain = "<%= @chain %>"
|
|
||||||
base_path = "<%= @base_path %>"
|
|
||||||
[network]
|
|
||||||
port = <%= @network_port %>
|
|
||||||
[rpc]
|
|
||||||
# JSON-RPC over HTTP
|
|
||||||
port = <%= @json_rpc_port %>
|
|
||||||
[dapps]
|
|
||||||
# Dapps Server
|
|
||||||
port = <%= @dapps_port %>
|
|
||||||
[ui]
|
|
||||||
port = <%= @ui_port %>
|
|
Loading…
x
Reference in New Issue
Block a user