-
Notifications
You must be signed in to change notification settings - Fork 487
Added the ability to pass arbitrary headers. #187
Conversation
Updated documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
echo -e " --ca-file-path\t\tPath to a PEM-encoded certificate authority used to encrypt and verify authenticity of client and server connections. Will be installed under <install-path>/tls/ca." | ||
echo -e " --cert-file-path\t\tPath to a PEM-encoded certificate, which will be provided to clients or servers to verify the agent's authenticity. Will be installed under <install-path>/tls. Must be provided along with --key-file-path." | ||
echo -e " --key-file-path\t\tPath to a PEM-encoded private key, used with the certificate to verify the agent's authenticity. Will be installed under <install-path>/tls. Must be provided along with --cert-file-path" | ||
echo -e " --help | -h\t\tPrints this usage message." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind moving the single-param options (e.g., -h
and -v
) to a separate PR? It makes it easier to review, release, revert, debug, etc. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try and get to that this weekend.
|
||
if [[ -z "$download_url" && -n "$version" ]]; then | ||
download_url="https://releases.hashicorp.com/consul/${version}/consul_${version}_linux_amd64.zip" | ||
fi | ||
|
||
if [[ ! -z "$addtl_headers" ]]; then | ||
local headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this declaration outside the if-statement.
|
||
for value in "${addtl_headers[@]}" | ||
do | ||
headers+="-H \"$value\" " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly cleaner to make headers
an array (declare it up above local -a headers=()
), appending to it here via headers+=("-H \"$value\"")
, and expanding it in the curl
command below with ${headers[@]}
.
Co-authored-by: Yevgeniy Brikman <[email protected]>
According to google arrays are always local so that bit is redundant but I like it for consistency. Co-authored-by: Yevgeniy Brikman <[email protected]>
Meant to add that, ty. Co-authored-by: Yevgeniy Brikman <[email protected]>
Co-authored-by: Yevgeniy Brikman <[email protected]>
Co-authored-by: Yevgeniy Brikman <[email protected]>
Added a --header | -H option to allow the passing of arbitrary headers.
Fixes #186