Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add http headers #202

Merged
merged 10 commits into from
Oct 6, 2022
Merged

Conversation

BenediktBertsch
Copy link
Contributor

@BenediktBertsch BenediktBertsch commented Oct 4, 2022

Add support for http headers, fixes feature request #196.
Credits to @forthal for helping me out.

cli/cobra.go Outdated
@@ -59,7 +59,10 @@ func Client(apiUlr, userID, password, otp string) (c *proxmox.Client, err error)
if otp == "" {
otp = os.Getenv("PM_OTP")
}
c, err = proxmox.NewClient(apiUlr, nil, tlsconf, proxyUrl, timeout)
if http_headers == "" {
otp = os.Getenv("HTTP_HEADERS")
Copy link
Collaborator

Choose a reason for hiding this comment

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

error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, overlooked it my bad.

cli/cobra.go Outdated
@@ -59,7 +59,10 @@ func Client(apiUlr, userID, password, otp string) (c *proxmox.Client, err error)
if otp == "" {
otp = os.Getenv("PM_OTP")
}
c, err = proxmox.NewClient(apiUlr, nil, tlsconf, proxyUrl, timeout)
if http_headers == "" {
http_headers = os.Getenv("HTTP_HEADERS")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would use PM_HTTP_HEADERS for coherence with other envs, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Works out for me.

@mleone87
Copy link
Collaborator

mleone87 commented Oct 5, 2022

I just ran this PR code with no PM_HTTP_HEADERS set and it does not work

error the value of key (Header key(s) and value(s) not even. Check your PM_HTTP_HEADERS env.) may not be empty

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

Successfully merging this pull request may close these issues.

3 participants