Also do not connect IPFS to the local network to avoid getting our server blocked by Hetzner
29 lines
814 B
Ruby
29 lines
814 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)
|
|
execute "ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/9090" 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
|
|
|
|
# Set up CORS headers
|
|
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"
|
|
notifies :restart, "service[ipfs]", :delayed
|
|
end
|