1

In a shell script, I need to pull a private key from a .pem file. When I set my AUTORIZATION variable to the path, the variable is only the filepath string, not the actual filepath.

If I change my AUTHORIZATION variable to cat <FILE_PATH> it imports the header and footer i.e. -----BEGIN RSA PRIVATE KEY... END RSA PRIVATE KEY-----

How do I pull out the RSA key without the header and footer?

CLUSTER=standalone
TENANT=climate
NAMESPACE=integration_test
AUTHORIZATION=$REPO_ROOT/pulsar/tls/broker/broker.key.pem

echo $AUTHORIZATION

# Create tenant
curl -L -X PUT "http://localhost:$HOST_PULSAR_PORT/admin/v2/tenants/$TENANT" \
    --header "Authorization: Bearer $AUTHORIZATION" \
    --header 'Content-Type: application/json' \
    --data-raw "{\"allowedClusters\": [\"$CLUSTER\"]}"

1 Answer 1

1

You may use cat to get the output from the file location and then stored that to the variable

AUTHORIZATION=$(cat $REPO_ROOT/pulsar/tls/broker/broker.key.pem)

You may refer to this question

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.