{"action":"created","comment":{"url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/comments/85350954","pull_request_review_id":6071997,"id":85350954,"diff_hunk":"@@ -48,22 +53,36 @@ func main() {\n \t\treturn\n \t}\n \n-\tif opts.NArgs() != 1 && opts.NArgs() != 2 {\n+\tif opts.NArgs() > 2 {\n \t\tgetopt.PrintUsage(os.Stderr)\n \t\tos.Exit(1)\n \t\treturn\n \t}\n \n+\tvar target *url.URL\n+\tvar err error\n \targs := opts.Args()\n-\ttarget, err := url.Parse(args[0])\n-\tif err != nil {\n-\t\tfmt.Fprintf(os.Stderr, \"failed to parse target '%s': %s\\n\", args[0], err)\n-\t\tos.Exit(1)\n-\t\treturn\n+\tif len(args) == 0 {\n+\t\ttarget, err = url.Parse(os.Getenv(\"GOTCHA_BACKEND\"))","path":"main.go","position":32,"original_position":32,"commit_id":"39a81947b075297b3e7931e71a768a4c3000512f","original_commit_id":"39a81947b075297b3e7931e71a768a4c3000512f","user":{"login":"jhunt","id":20047,"avatar_url":"https://avatars.githubusercontent.com/u/20047?v=3","gravatar_id":"","url":"https://api.github.com/users/jhunt","html_url":"https://github.com/jhunt","followers_url":"https://api.github.com/users/jhunt/followers","following_url":"https://api.github.com/users/jhunt/following{/other_user}","gists_url":"https://api.github.com/users/jhunt/gists{/gist_id}","starred_url":"https://api.github.com/users/jhunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhunt/subscriptions","organizations_url":"https://api.github.com/users/jhunt/orgs","repos_url":"https://api.github.com/users/jhunt/repos","events_url":"https://api.github.com/users/jhunt/events{/privacy}","received_events_url":"https://api.github.com/users/jhunt/received_events","type":"User","site_admin":false},"body":"What happens here if we run the command without arguments, but _don't_ specify the `GOTCHA_BACKEND` environment variable?\r\n\r\nI would like to see a more helpful error message like:\r\n> No backend host specified, and no $GOTCHA_BACKEND environment variable set\r\n> If you are deploying gotcha as a Cloud Foundry application, don't forget to `cf set-env appname GOTCHA_BACKEND https://host/url\r\n\r\nThat way, when I forget how to use this, the tools tell me what I done forgot.","created_at":"2016-10-27T14:39:34Z","updated_at":"2016-10-27T14:39:56Z","html_url":"https://github.com/starkandwayne/gotcha/pull/3#discussion_r85350954","pull_request_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/comments/85350954"},"html":{"href":"https://github.com/starkandwayne/gotcha/pull/3#discussion_r85350954"},"pull_request":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3","id":91066074,"html_url":"https://github.com/starkandwayne/gotcha/pull/3","diff_url":"https://github.com/starkandwayne/gotcha/pull/3.diff","patch_url":"https://github.com/starkandwayne/gotcha/pull/3.patch","issue_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/3","number":3,"state":"open","locked":false,"title":"Allow gotcha to run as a cf app","user":{"login":"geofffranks","id":7180882,"avatar_url":"https://avatars.githubusercontent.com/u/7180882?v=3","gravatar_id":"","url":"https://api.github.com/users/geofffranks","html_url":"https://github.com/geofffranks","followers_url":"https://api.github.com/users/geofffranks/followers","following_url":"https://api.github.com/users/geofffranks/following{/other_user}","gists_url":"https://api.github.com/users/geofffranks/gists{/gist_id}","starred_url":"https://api.github.com/users/geofffranks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geofffranks/subscriptions","organizations_url":"https://api.github.com/users/geofffranks/orgs","repos_url":"https://api.github.com/users/geofffranks/repos","events_url":"https://api.github.com/users/geofffranks/events{/privacy}","received_events_url":"https://api.github.com/users/geofffranks/received_events","type":"User","site_admin":false},"body":"`gotcha` can now run as a Cloud Foundry app. It pulls\r\n`PORT` from the environment to determine what to bind to,\r\nand its target from the `GOTCHA_BACKEND` environment variable.\r\n\r\nThe `PORT` env var is only used if no ports are explicitly\r\nconfigured via the CLI invocation of `gotcha`. If neither\r\nCLI args nor `PORT` env var exists, fails back to port 3128.\r\n\r\nThe `GOTCHA_BACKEND` env var is only used when there are no\r\nCLI args to gotcha at all. Otherwise, the behavior is the same\r\nas it previously was.\r\n\r\nAdditionally, the `SSL_SKIP_VERIFY` environment variable\r\ncan be used to disable SSL certificate checking of the\r\nbackend gotcha is hooked up to.\r\n\r\nAnd for kicks, the HTTP_PROXY/HTTPS_PROXY/NO_PROXY env\r\nvars are now also supported","created_at":"2016-10-26T18:57:10Z","updated_at":"2016-10-27T14:39:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b80f1ee4881fef5091912b0098ee6c425e2f0e0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3/commits","review_comments_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3/comments","review_comment_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls/comments{/number}","comments_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/3/comments","statuses_url":"https://api.github.com/repos/starkandwayne/gotcha/statuses/39a81947b075297b3e7931e71a768a4c3000512f","head":{"label":"starkandwayne:cf_ify","ref":"cf_ify","sha":"39a81947b075297b3e7931e71a768a4c3000512f","user":{"login":"starkandwayne","id":2721362,"avatar_url":"https://avatars.githubusercontent.com/u/2721362?v=3","gravatar_id":"","url":"https://api.github.com/users/starkandwayne","html_url":"https://github.com/starkandwayne","followers_url":"https://api.github.com/users/starkandwayne/followers","following_url":"https://api.github.com/users/starkandwayne/following{/other_user}","gists_url":"https://api.github.com/users/starkandwayne/gists{/gist_id}","starred_url":"https://api.github.com/users/starkandwayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starkandwayne/subscriptions","organizations_url":"https://api.github.com/users/starkandwayne/orgs","repos_url":"https://api.github.com/users/starkandwayne/repos","events_url":"https://api.github.com/users/starkandwayne/events{/privacy}","received_events_url":"https://api.github.com/users/starkandwayne/received_events","type":"Organization","site_admin":false},"repo":{"id":52330582,"name":"gotcha","full_name":"starkandwayne/gotcha","owner":{"login":"starkandwayne","id":2721362,"avatar_url":"https://avatars.githubusercontent.com/u/2721362?v=3","gravatar_id":"","url":"https://api.github.com/users/starkandwayne","html_url":"https://github.com/starkandwayne","followers_url":"https://api.github.com/users/starkandwayne/followers","following_url":"https://api.github.com/users/starkandwayne/following{/other_user}","gists_url":"https://api.github.com/users/starkandwayne/gists{/gist_id}","starred_url":"https://api.github.com/users/starkandwayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starkandwayne/subscriptions","organizations_url":"https://api.github.com/users/starkandwayne/orgs","repos_url":"https://api.github.com/users/starkandwayne/repos","events_url":"https://api.github.com/users/starkandwayne/events{/privacy}","received_events_url":"https://api.github.com/users/starkandwayne/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/starkandwayne/gotcha","description":"A Debugging MiTM HTTP Proxy","fork":false,"url":"https://api.github.com/repos/starkandwayne/gotcha","forks_url":"https://api.github.com/repos/starkandwayne/gotcha/forks","keys_url":"https://api.github.com/repos/starkandwayne/gotcha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starkandwayne/gotcha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starkandwayne/gotcha/teams","hooks_url":"https://api.github.com/repos/starkandwayne/gotcha/hooks","issue_events_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/events{/number}","events_url":"https://api.github.com/repos/starkandwayne/gotcha/events","assignees_url":"https://api.github.com/repos/starkandwayne/gotcha/assignees{/user}","branches_url":"https://api.github.com/repos/starkandwayne/gotcha/branches{/branch}","tags_url":"https://api.github.com/repos/starkandwayne/gotcha/tags","blobs_url":"https://api.github.com/repos/starkandwayne/gotcha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starkandwayne/gotcha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starkandwayne/gotcha/git/refs{/sha}","trees_url":"https://api.github.com/repos/starkandwayne/gotcha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starkandwayne/gotcha/statuses/{sha}","languages_url":"https://api.github.com/repos/starkandwayne/gotcha/languages","stargazers_url":"https://api.github.com/repos/starkandwayne/gotcha/stargazers","contributors_url":"https://api.github.com/repos/starkandwayne/gotcha/contributors","subscribers_url":"https://api.github.com/repos/starkandwayne/gotcha/subscribers","subscription_url":"https://api.github.com/repos/starkandwayne/gotcha/subscription","commits_url":"https://api.github.com/repos/starkandwayne/gotcha/commits{/sha}","git_commits_url":"https://api.github.com/repos/starkandwayne/gotcha/git/commits{/sha}","comments_url":"https://api.github.com/repos/starkandwayne/gotcha/comments{/number}","issue_comment_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/comments{/number}","contents_url":"https://api.github.com/repos/starkandwayne/gotcha/contents/{+path}","compare_url":"https://api.github.com/repos/starkandwayne/gotcha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starkandwayne/gotcha/merges","archive_url":"https://api.github.com/repos/starkandwayne/gotcha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starkandwayne/gotcha/downloads","issues_url":"https://api.github.com/repos/starkandwayne/gotcha/issues{/number}","pulls_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls{/number}","milestones_url":"https://api.github.com/repos/starkandwayne/gotcha/milestones{/number}","notifications_url":"https://api.github.com/repos/starkandwayne/gotcha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starkandwayne/gotcha/labels{/name}","releases_url":"https://api.github.com/repos/starkandwayne/gotcha/releases{/id}","deployments_url":"https://api.github.com/repos/starkandwayne/gotcha/deployments","created_at":"2016-02-23T04:38:34Z","updated_at":"2016-10-20T16:57:10Z","pushed_at":"2016-10-26T18:58:58Z","git_url":"git://github.com/starkandwayne/gotcha.git","ssh_url":"git@github.com:starkandwayne/gotcha.git","clone_url":"https://github.com/starkandwayne/gotcha.git","svn_url":"https://github.com/starkandwayne/gotcha","homepage":"","size":30,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"starkandwayne:master","ref":"master","sha":"de077433562494324bdd782d1d0c8536b7ec745e","user":{"login":"starkandwayne","id":2721362,"avatar_url":"https://avatars.githubusercontent.com/u/2721362?v=3","gravatar_id":"","url":"https://api.github.com/users/starkandwayne","html_url":"https://github.com/starkandwayne","followers_url":"https://api.github.com/users/starkandwayne/followers","following_url":"https://api.github.com/users/starkandwayne/following{/other_user}","gists_url":"https://api.github.com/users/starkandwayne/gists{/gist_id}","starred_url":"https://api.github.com/users/starkandwayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starkandwayne/subscriptions","organizations_url":"https://api.github.com/users/starkandwayne/orgs","repos_url":"https://api.github.com/users/starkandwayne/repos","events_url":"https://api.github.com/users/starkandwayne/events{/privacy}","received_events_url":"https://api.github.com/users/starkandwayne/received_events","type":"Organization","site_admin":false},"repo":{"id":52330582,"name":"gotcha","full_name":"starkandwayne/gotcha","owner":{"login":"starkandwayne","id":2721362,"avatar_url":"https://avatars.githubusercontent.com/u/2721362?v=3","gravatar_id":"","url":"https://api.github.com/users/starkandwayne","html_url":"https://github.com/starkandwayne","followers_url":"https://api.github.com/users/starkandwayne/followers","following_url":"https://api.github.com/users/starkandwayne/following{/other_user}","gists_url":"https://api.github.com/users/starkandwayne/gists{/gist_id}","starred_url":"https://api.github.com/users/starkandwayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starkandwayne/subscriptions","organizations_url":"https://api.github.com/users/starkandwayne/orgs","repos_url":"https://api.github.com/users/starkandwayne/repos","events_url":"https://api.github.com/users/starkandwayne/events{/privacy}","received_events_url":"https://api.github.com/users/starkandwayne/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/starkandwayne/gotcha","description":"A Debugging MiTM HTTP Proxy","fork":false,"url":"https://api.github.com/repos/starkandwayne/gotcha","forks_url":"https://api.github.com/repos/starkandwayne/gotcha/forks","keys_url":"https://api.github.com/repos/starkandwayne/gotcha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starkandwayne/gotcha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starkandwayne/gotcha/teams","hooks_url":"https://api.github.com/repos/starkandwayne/gotcha/hooks","issue_events_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/events{/number}","events_url":"https://api.github.com/repos/starkandwayne/gotcha/events","assignees_url":"https://api.github.com/repos/starkandwayne/gotcha/assignees{/user}","branches_url":"https://api.github.com/repos/starkandwayne/gotcha/branches{/branch}","tags_url":"https://api.github.com/repos/starkandwayne/gotcha/tags","blobs_url":"https://api.github.com/repos/starkandwayne/gotcha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starkandwayne/gotcha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starkandwayne/gotcha/git/refs{/sha}","trees_url":"https://api.github.com/repos/starkandwayne/gotcha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starkandwayne/gotcha/statuses/{sha}","languages_url":"https://api.github.com/repos/starkandwayne/gotcha/languages","stargazers_url":"https://api.github.com/repos/starkandwayne/gotcha/stargazers","contributors_url":"https://api.github.com/repos/starkandwayne/gotcha/contributors","subscribers_url":"https://api.github.com/repos/starkandwayne/gotcha/subscribers","subscription_url":"https://api.github.com/repos/starkandwayne/gotcha/subscription","commits_url":"https://api.github.com/repos/starkandwayne/gotcha/commits{/sha}","git_commits_url":"https://api.github.com/repos/starkandwayne/gotcha/git/commits{/sha}","comments_url":"https://api.github.com/repos/starkandwayne/gotcha/comments{/number}","issue_comment_url":"https://api.github.com/repos/starkandwayne/gotcha/issues/comments{/number}","contents_url":"https://api.github.com/repos/starkandwayne/gotcha/contents/{+path}","compare_url":"https://api.github.com/repos/starkandwayne/gotcha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starkandwayne/gotcha/merges","archive_url":"https://api.github.com/repos/starkandwayne/gotcha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starkandwayne/gotcha/downloads","issues_url":"https://api.github.com/repos/starkandwayne/gotcha/issues{/number}","pulls_url":"https://api.github.com/repos/starkandwayne/gotcha/pulls{/number}","milestones_url":"https://api.github.com/repos/starkandwayne/gotcha/milestones{/number}","notifications_url":"https://api.github.com/repos/starkandwayne/gotcha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starkandwayne/gotcha/labels{/name}","releases_url":"https://api.github.com/repos/starkandwayne/gotcha/releases{/id}","deployments_url":"https://api.github.com/repos/starkandwayne/gotcha/deployments","created_at":"2016-02-23T04:38:34Z","updated_at":"2016-10-20T16:57:10Z","pushed_at":"2016-10-26T18:58:58Z","git_url":"git://github.com/starkandwayne/gotcha.git","ssh_url":"git@github.com:starkandwayne/gotcha.git","clone_url":"https://github.com/starkandwayne/gotcha.git","svn_url":"https://github.com/starkandwayne/gotcha","homepage":"","size":30,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3"},"html":{"href":"https://github.com/starkandwayne/gotcha/pull/3"},"issue":{"href":"https://api.github.com/repos/starkandwayne/gotcha/issues/3"},"comments":{"href":"https://api.github.com/repos/starkandwayne/gotcha/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/starkandwayne/gotcha/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/starkandwayne/gotcha/statuses/39a81947b075297b3e7931e71a768a4c3000512f"}}}}
{"actor":{"display_login":"jhunt"}}