Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Feature/add nomad token support #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sshuliar
Copy link

No description provided.

@hashicorp-cla
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


Serhii Shuiar seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA. If you already have a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@@ -136,6 +136,9 @@ def request(verb, path, data = {}, headers = {})
# Get a list of headers
headers = DEFAULT_HEADERS.merge(headers)

# Dynamically read Nomad ACL token
headers = headers.merge({"X-Nomad-Token" => nomad_token})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind guarding this so if nomad_token is nil the header is excluded.

end
end


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

nit: extra newline

@@ -31,7 +31,7 @@ class Response

# Parses the value as a string, converting "" to nil (go compat).
string_as_nil: ->(item) {
if item.nil? || item.strip.empty?
if item.nil? || item.to_s.strip.empty?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change necessary?

Copy link

@drewbailey drewbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! One small change to exclude the header if it's nil, and a question about casting the string_as_nil to a string

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants