diff --git a/Dockerfile b/Dockerfile index 4e0db17242..a688f82b9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ENV IPFS_WRTC_LINUX_WINDOWS=1 ENV IPFS_BOOTSTRAP=1 ENV IPFS_MONITORING=1 ENV IPFS_PATH=/root/.jsipfs +ENV IPFS_API_HOST=0.0.0.0 ENV BUILD_DEPS='libnspr4 libnspr4-dev libnss3' diff --git a/init-and-daemon.sh b/init-and-daemon.sh index 0085bce4a5..f406b5aa11 100755 --- a/init-and-daemon.sh +++ b/init-and-daemon.sh @@ -2,17 +2,19 @@ set -e -if [ -n $IPFS_PATH ]; then +if [ -n "$IPFS_PATH" ]; then echo "Using $IPFS_PATH as IPFS repository" else echo "You need to set IPFS_PATH environment variable to use this script" exit 1 fi -sed -i.bak 's/127.0.0.1/0.0.0.0/g' $IPFS_PATH/config - # Initialize the repo but ignore if error if it already exists # This can be the case when we restart a container without stopping/removing it node src/cli/bin.js init || true +if [ -n "$IPFS_API_HOST" ]; then + sed -i.bak "s/127.0.0.1/$IPFS_API_HOST/g" $IPFS_PATH/config +fi + node src/cli/bin.js daemon