Split up kosmos config from the ipfs cookbook
Also do not connect IPFS to the local network to avoid getting our server blocked by Hetzner
This commit is contained in:
@@ -70,20 +70,20 @@ else
|
||||
provider Chef::Provider::Service::Systemd
|
||||
action [:enable]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Configure ipfs
|
||||
execute "ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/9090" do
|
||||
# Configure ipfs to not contact local network addresses
|
||||
execute "ipfs config --json Swarm.AddrFilters '#{node['ipfs']['config']['swarm']['addr_filter'].to_json}'" do
|
||||
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
|
||||
user "ipfs"
|
||||
not_if "ipfs config Addresses.Gateway | grep /ip4/127.0.0.1/tcp/9090"
|
||||
notifies :restart, "service[ipfs]", :delayed
|
||||
end
|
||||
|
||||
execute "ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"kredits.kosmos.org\"]'" do
|
||||
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
|
||||
user "ipfs"
|
||||
not_if "ipfs config API.HTTPHeaders.Access-Control-Allow-Origin | grep kredits.kosmos.org"
|
||||
not_if do
|
||||
require 'json'
|
||||
swarm_filter_config = `ipfs config Swarm.AddrFilters`
|
||||
begin
|
||||
JSON.parse(swarm_filter_config) == node['ipfs']['config']['swarm']['addr_filter']
|
||||
rescue JSON::ParserError
|
||||
false
|
||||
end
|
||||
end
|
||||
notifies :restart, "service[ipfs]", :delayed
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user