Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

config: respect proxy_* settings in agent #251

Merged
merged 5 commits into from
Mar 21, 2017
Merged

config: respect proxy_* settings in agent #251

merged 5 commits into from
Mar 21, 2017

Conversation

talwai
Copy link

@talwai talwai commented Mar 20, 2017

when proxy
settings
are defined in datadog.conf
update the default client in the writer to submit to a proxy.

fixes #245

@talwai talwai added this to the 5.13 milestone Mar 20, 2017
@talwai talwai requested review from LeoCavaille and ufoot March 20, 2017 22:54
Copy link

@ufoot ufoot left a comment

Choose a reason for hiding this comment

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

Cool! I think we should add some special chars handling.

config/proxy.go Outdated
var userpass string
if p.User != "" {
if p.Password != "" {
userpass = fmt.Sprintf("%s:%s@", p.User, p.Password)
Copy link

Choose a reason for hiding this comment

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

@@ -0,0 +1,59 @@
package config
Copy link

Choose a reason for hiding this comment

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

I like the idea of having a separate chunk of code / struct to handle this. Indeed, it is not really agent specific.

"proxy_host = https://myhost",
"proxy_port = 3129",
"proxy_user = aaditya",
"proxy_password = password_12",
Copy link

Choose a reason for hiding this comment

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

You should probably add a test with some special chars such as /:\!?&;=@éÔγλῶσσα, and test that ProxySettings.URL() returns the expected value.

@talwai
Copy link
Author

talwai commented Mar 21, 2017

Yes good catch on the special chars handling. I've addressed this in 9486db3

assert.Nil(err)

// password is url-encoded and decodes to the original string
assert.Equal("https://aaditya:%2F%3A%21%3F&=%40%C3%A9%C3%94%CE%B3%CE%BB%E1%BF%B6%CF%83%CF%83%CE%B1@myhost:3129", s.String())
Copy link

@ufoot ufoot Mar 21, 2017

Choose a reason for hiding this comment

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

Github highlights some of this in red, dunno why, but LGTM anyway.

Copy link

@ufoot ufoot left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants