fix configs
This commit is contained in:
parent
68ed014b74
commit
9f2e746163
|
|
@ -18,11 +18,10 @@ ipfs config --json Reprovider '{ "Interval": "22h", "Strategy": "pinned+mfs" }'
|
||||||
ipfs config --json Swarm.ConnMgr '{ "Type": "basic", "LowWater": 50, "HighWater": 200, "GracePeriod": "20s" }'
|
ipfs config --json Swarm.ConnMgr '{ "Type": "basic", "LowWater": 50, "HighWater": 200, "GracePeriod": "20s" }'
|
||||||
|
|
||||||
# Disable public AutoConf when running with a private swarm key
|
# Disable public AutoConf when running with a private swarm key
|
||||||
ipfs config AutoConf.Enabled false
|
ipfs config --json AutoConf.Enabled false
|
||||||
|
|
||||||
# CORS for RPC API (visible only in docker network)
|
# CORS for RPC API (visible only in docker network)
|
||||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
|
||||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT","POST","GET"]'
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT","POST","GET"]'
|
||||||
|
|
||||||
echo "IPFS init script applied"
|
echo "IPFS init script applied"
|
||||||
|
|
||||||
|
|
|
||||||
22
start.sh
22
start.sh
|
|
@ -36,6 +36,27 @@ if [[ "$NODE_PRIVACY" != "public" && "$NODE_PRIVACY" != "private" ]]; then
|
||||||
NODE_PRIVACY=public
|
NODE_PRIVACY=public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Strip leading KEY= or export KEY= that users may paste
|
||||||
|
sanitize_assignment() {
|
||||||
|
local key="$1" value="$2"
|
||||||
|
|
||||||
|
if [[ $value == export\ * ]]; then
|
||||||
|
value=${value#export }
|
||||||
|
fi
|
||||||
|
|
||||||
|
local prefix="${key}="
|
||||||
|
if [[ $value == "$prefix"* ]]; then
|
||||||
|
value=${value#$prefix}
|
||||||
|
fi
|
||||||
|
|
||||||
|
value="${value#\"}"
|
||||||
|
value="${value%\"}"
|
||||||
|
value="${value#\'}"
|
||||||
|
value="${value%\'}"
|
||||||
|
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
# Helper to prompt only if missing in .env
|
# Helper to prompt only if missing in .env
|
||||||
ask_or_keep() {
|
ask_or_keep() {
|
||||||
local key="$1"; shift
|
local key="$1"; shift
|
||||||
|
|
@ -64,6 +85,7 @@ ask_or_keep() {
|
||||||
else
|
else
|
||||||
read -rp "$prompt: " val || true
|
read -rp "$prompt: " val || true
|
||||||
fi
|
fi
|
||||||
|
val=$(sanitize_assignment "$key" "$val")
|
||||||
eval "$key=\"$val\""
|
eval "$key=\"$val\""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue