43 lines
		
	
	
		
			854 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			854 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
#
 | 
						|
# Cookbook Name:: kosmos-ipfs
 | 
						|
# Recipe:: default
 | 
						|
#
 | 
						|
# Copyright 2017, Kosmos
 | 
						|
#
 | 
						|
# All rights reserved - Do Not Redistribute
 | 
						|
#
 | 
						|
 | 
						|
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
 |