Skip to content

Commit

Permalink
honor proxy settings in the environment (#45)
Browse files Browse the repository at this point in the history
Resolves #44

The default go http library honors settings from the environment with the built in ProxyFromEnvironment function. This change configures samproxy to use the same thing.

Coming along for the ride is an update to the circle ci config to get the build to run.
  • Loading branch information
maplebed authored Jul 1, 2019
1 parent 00fea42 commit 19a244b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
buildevents: honeycombio/[email protected].2
buildevents: honeycombio/[email protected].3

executors:
linuxgo:
Expand All @@ -16,6 +16,12 @@ jobs:
steps:
- buildevents/start_trace

# finish_trace:
# executor: linuxgo
# steps:
# - buildevents/finish_trace:
# success: true

test:
executor: linuxgo
steps:
Expand Down Expand Up @@ -79,31 +85,25 @@ jobs:
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ./artifacts/samproxy_${CIRCLE_TAG:1:20}_amd64.deb
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ./artifacts/samproxy-${CIRCLE_TAG:1:20}-1.x86_64.rpm
finish_trace:
executor: linuxgo
steps:
- buildevents/finish_trace:
result: success

workflows:
build:
jobs:
- setup:
filters:
tags:
only: /.*/
# - finish_trace:
# requires:
# - setup
# filters:
# tags:
# only: /.*/
- test:
requires:
- setup
filters:
tags:
only: /.*/
- finish_trace:
requires:
- test
filters:
tags:
only: /.*/
- build:
requires:
- test
Expand Down
2 changes: 2 additions & 0 deletions cmd/samproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func main() {

// upstreamTransport is the http transport used to send things on to Honeycomb
upstreamTransport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 10 * time.Second,
}).Dial,
Expand All @@ -103,6 +104,7 @@ func main() {

// peerTransport is the http transport used to send things to a local peer
peerTransport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 3 * time.Second,
}).Dial,
Expand Down

0 comments on commit 19a244b

Please sign in to comment.