From 6fcc5216a662c2c136211d13e526cc8f3e47b168 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 10 Feb 2021 23:40:39 -0800 Subject: [PATCH] Missing $ on auth vars --- upload.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/upload.sh b/upload.sh index 9c61d31..462deb2 100755 --- a/upload.sh +++ b/upload.sh @@ -1,12 +1,12 @@ #!/bin/bash -if [ ! -z $CI_COMMIT_BRANCH ];then - echo Gitlab CI Detected! - echo export KEY=$NEOCITIES_KEY >> .env +if [ ! -z .env ];then + # no env means we have to use the neocities var + export KEY=$NEOCITIES_KEY +else + source .env fi -source .env - url="https://neocities.org" site=.mirror auth="Authorization: Bearer $KEY" @@ -21,7 +21,7 @@ _upload_html() { for f in $@;do remote_path=${f:1} echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload - curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload + curl -s -o /dev/null -w '%{http_code}' -H "$auth" -F "$remote_path=@$f" $url/api/upload done } @@ -33,7 +33,7 @@ _upload_media() { for f in $@;do remote_path=${f:1} echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload - curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload + curl -s -o /dev/null -w '%{http_code}' -H "$auth" -F "$remote_path=@$f" $url/api/upload done } @@ -82,7 +82,7 @@ if [ -z $1 ];then _help else pushd $site > /dev/null - while getopts ':Hhrf:s:m:M' opt;do + while getopts 'a::Hhrf:s:m:M' opt;do case $opt in H) _help;; h) _upload_html $(find -name '*.html');; # Upload all html content