forked from Qortal/qortal
Various qdata improvements
This commit is contained in:
parent
651ca71126
commit
24ca126f5a
14
tools/qdata
14
tools/qdata
@ -8,10 +8,10 @@ if [ -z "$*" ]; then
|
|||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo
|
echo
|
||||||
echo "Host/update data:"
|
echo "Host/update data:"
|
||||||
echo "qdata [PUT/PATCH] [service] [name] [directory] [privkey]"
|
echo "qdata [PUT/PATCH] [service] [name] [dirpath]"
|
||||||
echo
|
echo
|
||||||
echo "Fetch data:"
|
echo "Fetch data:"
|
||||||
echo "qdata GET [service] [name] [filename] <rebuild>"
|
echo "qdata GET [service] [name] [filepath] <rebuild>"
|
||||||
echo
|
echo
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -63,11 +63,11 @@ if [[ "${method}" == "PUT" || "${method}" == "PATCH" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ "${method}" == "GET" ]]; then
|
elif [[ "${method}" == "GET" ]]; then
|
||||||
filename=$4
|
filepath=$4
|
||||||
rebuild=$5
|
rebuild=$5
|
||||||
|
|
||||||
if [ -z "${filename}" ]; then
|
if [ -z "${filepath}" ]; then
|
||||||
filename="index.html"
|
echo "Error: missing filepath. Please supply the relative path to a file within the data structure."; exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${rebuild}" ]; then
|
if [ -z "${rebuild}" ]; then
|
||||||
@ -80,10 +80,10 @@ elif [[ "${method}" == "GET" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse the successful response
|
# Parse the successful response
|
||||||
output_path="${response}/${filename}"
|
output_path="${response}/${filepath}"
|
||||||
if [ ! -f "${output_path}" ] && [ ! -d "${output_path}" ]; then
|
if [ ! -f "${output_path}" ] && [ ! -d "${output_path}" ]; then
|
||||||
echo "Error: file not found at path: ${output_path}"
|
echo "Error: file not found at path: ${output_path}"
|
||||||
echo "Please ensure you have supplied a valid filename. The default is: index.html"
|
echo "Please ensure you have supplied a valid filepath."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user