removed use of eval in posix scripts
This commit is contained in:
@@ -578,8 +578,11 @@ load_env_file() {
|
|||||||
value="$(echo "$value" | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//')"
|
value="$(echo "$value" | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//')"
|
||||||
|
|
||||||
case "$key" in
|
case "$key" in
|
||||||
EBKTOOL_SERVER_BASEURL|EBKTOOL_TOKEN)
|
EBKTOOL_SERVER_BASEURL)
|
||||||
eval "$key=\"\$value\""
|
EBKTOOL_SERVER_BASEURL="$value"
|
||||||
|
;;
|
||||||
|
EBKTOOL_TOKEN)
|
||||||
|
EBKTOOL_TOKEN="$value"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < "$env_file"
|
done < "$env_file"
|
||||||
@@ -1124,7 +1127,7 @@ call_api() {
|
|||||||
if [ "$json_params" != "{}" ]; then
|
if [ "$json_params" != "{}" ]; then
|
||||||
if [ -n "$timezone_headers" ]; then
|
if [ -n "$timezone_headers" ]; then
|
||||||
response="$(curl -s -X "POST" \
|
response="$(curl -s -X "POST" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "$timezone_headers" \
|
-H "$timezone_headers" \
|
||||||
-d "$json_params" \
|
-d "$json_params" \
|
||||||
@@ -1132,7 +1135,7 @@ call_api() {
|
|||||||
curl_exit_code=$?
|
curl_exit_code=$?
|
||||||
else
|
else
|
||||||
response="$(curl -s -X "POST" \
|
response="$(curl -s -X "POST" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$json_params" \
|
-d "$json_params" \
|
||||||
"$url")"
|
"$url")"
|
||||||
@@ -1141,13 +1144,13 @@ call_api() {
|
|||||||
else
|
else
|
||||||
if [ -n "$timezone_headers" ]; then
|
if [ -n "$timezone_headers" ]; then
|
||||||
response="$(curl -s -X "POST" \
|
response="$(curl -s -X "POST" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
-H "$timezone_headers" \
|
-H "$timezone_headers" \
|
||||||
"$url")"
|
"$url")"
|
||||||
curl_exit_code=$?
|
curl_exit_code=$?
|
||||||
else
|
else
|
||||||
response="$(curl -s -X "POST" \
|
response="$(curl -s -X "POST" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
"$url")"
|
"$url")"
|
||||||
curl_exit_code=$?
|
curl_exit_code=$?
|
||||||
fi
|
fi
|
||||||
@@ -1162,12 +1165,12 @@ call_api() {
|
|||||||
|
|
||||||
if [ -n "$timezone_headers" ]; then
|
if [ -n "$timezone_headers" ]; then
|
||||||
response="$(curl -s -X "$method" \
|
response="$(curl -s -X "$method" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
-H "$timezone_headers" \
|
-H "$timezone_headers" \
|
||||||
"$url")"
|
"$url")"
|
||||||
else
|
else
|
||||||
response="$(curl -s -X "$method" \
|
response="$(curl -s -X "$method" \
|
||||||
-H "Authorization: Bearer $EBKTOOL_TOKEN" \
|
-H "Authorization: Bearer $authToken" \
|
||||||
"$url")"
|
"$url")"
|
||||||
fi
|
fi
|
||||||
curl_exit_code=$?
|
curl_exit_code=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user