diff --git a/tools/qort b/tools/qort index 732fb825..dcce34d2 100755 --- a/tools/qort +++ b/tools/qort @@ -10,6 +10,8 @@ example_host=node10.qortal.org # called-as name name="${0##*/}" +script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + while [ -n "$*" ]; do case $1 in -p) @@ -65,6 +67,12 @@ fi url=$1 shift +if [ -f "apikey.txt" ]; then + apikey=$(cat "apikey.txt") +elif [ -f "${script_dir}/../apikey.txt" ]; then + apikey=$(cat "${script_dir}/../apikey.txt") +fi + if [ "${url:0:4}" != "http" ]; then base_url=${BASE_URL-localhost:${port}} @@ -83,5 +91,5 @@ if [ "$#" != 0 ]; then data="--data" fi -curl --silent --insecure --connect-timeout 5 ${content_type:+--header} "${content_type}" ${method} ${src} --url ${url} ${data} "$@" | ${postproc} +curl --silent --insecure --connect-timeout 5 -H "X-API-KEY: ${apikey}" ${content_type:+--header} "${content_type}" ${method} ${src} --url ${url} ${data} "$@" | ${postproc} echo