62 lines
2.0 KiB
Ruby
62 lines
2.0 KiB
Ruby
#
|
|
# Cookbook Name:: kosmos-ipfs
|
|
# Recipe:: default
|
|
#
|
|
# The MIT License (MIT)
|
|
#
|
|
# Copyright:: 2019, Kosmos Developers
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
|
|
node.override['ipfs']['version'] = '0.4.18'
|
|
node.override['ipfs']['checksum'] = '21e6c44c0fa8edf91a727f1e8257342a4c3a879462e656861b0a179e1f6a03f6'
|
|
include_recipe "ipfs"
|
|
|
|
# Configure ipfs
|
|
|
|
# The default gateway is already used by kosmos' hubot (8080)
|
|
ipfs_config "Addresses.Gateway" do
|
|
value "/ip4/127.0.0.1/tcp/9090"
|
|
end
|
|
|
|
# Set up the Gateway to be writable
|
|
ipfs_config "Gateway.Writable" do
|
|
value true
|
|
end
|
|
|
|
# Set up CORS headers
|
|
ipfs_config "API.HTTPHeaders.Access-Control-Allow-Credentials" do
|
|
value ["true"]
|
|
end
|
|
ipfs_config "API.HTTPHeaders.Access-Control-Allow-Methods" do
|
|
value ["PUT", "GET", "POST"]
|
|
end
|
|
ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do
|
|
value ["*"]
|
|
end
|
|
|
|
unless node.chef_environment == "development"
|
|
include_recipe 'firewall'
|
|
firewall_rule 'ipfs_swarm_p2p' do
|
|
port 4001
|
|
protocol :tcp
|
|
command :allow
|
|
end
|
|
end
|