From 8b3a587fa92d203c0904d1c467c7a6e236660535 Mon Sep 17 00:00:00 2001 From: James Walker Date: Thu, 2 Feb 2023 23:11:20 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20better=20error=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pin.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pin.sh b/pin.sh index eef0278..eeafae5 100755 --- a/pin.sh +++ b/pin.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash + +set -e HOST=${PLUGIN_CLUSTER_HOST:-"/dns4/cluster.walkah.cloud"} @@ -10,16 +12,21 @@ root_cid=$(ipfs-cluster-ctl \ add \ --quieter \ --cid-version 1 \ - --name "${PLUGIN_DOMAIN}" \ + --name "$PLUGIN_DOMAIN" \ --recursive \ --local \ $PLUGIN_EXTRA_ARGS \ - "$PLUGIN_PATH" ) + "$PLUGIN_PATH" ) || { + echo "ipfs-cluster-ctl --host $HOST --basic-auth *** $PLUGIN_CLUSTER_ARGS add --quieter --local --wait --cid-version 1 --name $PLUGIN_DOMAIN --recursive $PLUGIN_PATH" + echo "FAILED to pin" + false + } +echo "Deployed: $root_cid" if [ ! -x "$PLUGIN_CF_EMAIL" ]; then export CF_API_EMAIL=$PLUGIN_CF_EMAIL export CF_API_KEY=$PLUGIN_CF_APIKEY - dnslink-cloudflare -d $PLUGIN_DOMAIN -l "/ipfs/${root_cid}" + dnslink-cloudflare -d $PLUGIN_DOMAIN -l "/ipfs/${root_cid}" -r _dnslink + echo "Updated $PLUGIN_DOMAIN" fi -echo "Deployed: $root_cid" \ No newline at end of file