{"action":"created","comment":{"url":"https://api.github.com/repos/dcos/mesos_state/pulls/comments/67944787","id":67944787,"diff_hunk":"@@ -36,6 +38,54 @@ maybe_enable_ssl(Options) ->\n       Options\n   end.\n \n+-spec(maybe_use_token(list()) -> list()).\n+maybe_use_token(Headers) ->","path":"src/mesos_state_client.erl","position":21,"original_position":21,"commit_id":"b2d85205755f84ac005fa2d6a598726e8da13ef2","original_commit_id":"b2d85205755f84ac005fa2d6a598726e8da13ef2","user":{"login":"sargun","id":750148,"avatar_url":"https://avatars.githubusercontent.com/u/750148?v=3","gravatar_id":"","url":"https://api.github.com/users/sargun","html_url":"https://github.com/sargun","followers_url":"https://api.github.com/users/sargun/followers","following_url":"https://api.github.com/users/sargun/following{/other_user}","gists_url":"https://api.github.com/users/sargun/gists{/gist_id}","starred_url":"https://api.github.com/users/sargun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sargun/subscriptions","organizations_url":"https://api.github.com/users/sargun/orgs","repos_url":"https://api.github.com/users/sargun/repos","events_url":"https://api.github.com/users/sargun/events{/privacy}","received_events_url":"https://api.github.com/users/sargun/received_events","type":"User","site_admin":false},"body":"Also, I’d refactor your flow a little bit\r\nI would make\r\n```maybe_use_token(Headers) ->\r\n +  case try_get_token() of\r\n +    undefined ->\r\n +      Headers;\r\n +    {ok, Token} ->\r\n +      [{\"Authorization\", Token}|Headers]\r\n +  end.\r\n```\r\nand then try_get_token can try getting it from an env variable, or a file","created_at":"2016-06-21T20:25:43Z","updated_at":"2016-06-21T20:25:43Z","html_url":"https://github.com/dcos/mesos_state/pull/9#discussion_r67944787","pull_request_url":"https://api.github.com/repos/dcos/mesos_state/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/comments/67944787"},"html":{"href":"https://github.com/dcos/mesos_state/pull/9#discussion_r67944787"},"pull_request":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/dcos/mesos_state/pulls/9","id":74527204,"html_url":"https://github.com/dcos/mesos_state/pull/9","diff_url":"https://github.com/dcos/mesos_state/pull/9.diff","patch_url":"https://github.com/dcos/mesos_state/pull/9.patch","issue_url":"https://api.github.com/repos/dcos/mesos_state/issues/9","number":9,"state":"open","locked":false,"title":"optionally provide token file to be read at each poll","user":{"login":"spacejam","id":1505488,"avatar_url":"https://avatars.githubusercontent.com/u/1505488?v=3","gravatar_id":"","url":"https://api.github.com/users/spacejam","html_url":"https://github.com/spacejam","followers_url":"https://api.github.com/users/spacejam/followers","following_url":"https://api.github.com/users/spacejam/following{/other_user}","gists_url":"https://api.github.com/users/spacejam/gists{/gist_id}","starred_url":"https://api.github.com/users/spacejam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacejam/subscriptions","organizations_url":"https://api.github.com/users/spacejam/orgs","repos_url":"https://api.github.com/users/spacejam/repos","events_url":"https://api.github.com/users/spacejam/events{/privacy}","received_events_url":"https://api.github.com/users/spacejam/received_events","type":"User","site_admin":false},"body":"@sargun ","created_at":"2016-06-20T22:58:20Z","updated_at":"2016-06-21T20:25:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16e3486b31aa2a296a015816eb537112665590ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dcos/mesos_state/pulls/9/commits","review_comments_url":"https://api.github.com/repos/dcos/mesos_state/pulls/9/comments","review_comment_url":"https://api.github.com/repos/dcos/mesos_state/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dcos/mesos_state/issues/9/comments","statuses_url":"https://api.github.com/repos/dcos/mesos_state/statuses/b2d85205755f84ac005fa2d6a598726e8da13ef2","head":{"label":"spacejam:tyler_token_file","ref":"tyler_token_file","sha":"b2d85205755f84ac005fa2d6a598726e8da13ef2","user":{"login":"spacejam","id":1505488,"avatar_url":"https://avatars.githubusercontent.com/u/1505488?v=3","gravatar_id":"","url":"https://api.github.com/users/spacejam","html_url":"https://github.com/spacejam","followers_url":"https://api.github.com/users/spacejam/followers","following_url":"https://api.github.com/users/spacejam/following{/other_user}","gists_url":"https://api.github.com/users/spacejam/gists{/gist_id}","starred_url":"https://api.github.com/users/spacejam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacejam/subscriptions","organizations_url":"https://api.github.com/users/spacejam/orgs","repos_url":"https://api.github.com/users/spacejam/repos","events_url":"https://api.github.com/users/spacejam/events{/privacy}","received_events_url":"https://api.github.com/users/spacejam/received_events","type":"User","site_admin":false},"repo":{"id":61566589,"name":"mesos_state","full_name":"spacejam/mesos_state","owner":{"login":"spacejam","id":1505488,"avatar_url":"https://avatars.githubusercontent.com/u/1505488?v=3","gravatar_id":"","url":"https://api.github.com/users/spacejam","html_url":"https://github.com/spacejam","followers_url":"https://api.github.com/users/spacejam/followers","following_url":"https://api.github.com/users/spacejam/following{/other_user}","gists_url":"https://api.github.com/users/spacejam/gists{/gist_id}","starred_url":"https://api.github.com/users/spacejam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacejam/subscriptions","organizations_url":"https://api.github.com/users/spacejam/orgs","repos_url":"https://api.github.com/users/spacejam/repos","events_url":"https://api.github.com/users/spacejam/events{/privacy}","received_events_url":"https://api.github.com/users/spacejam/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spacejam/mesos_state","description":"","fork":true,"url":"https://api.github.com/repos/spacejam/mesos_state","forks_url":"https://api.github.com/repos/spacejam/mesos_state/forks","keys_url":"https://api.github.com/repos/spacejam/mesos_state/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacejam/mesos_state/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacejam/mesos_state/teams","hooks_url":"https://api.github.com/repos/spacejam/mesos_state/hooks","issue_events_url":"https://api.github.com/repos/spacejam/mesos_state/issues/events{/number}","events_url":"https://api.github.com/repos/spacejam/mesos_state/events","assignees_url":"https://api.github.com/repos/spacejam/mesos_state/assignees{/user}","branches_url":"https://api.github.com/repos/spacejam/mesos_state/branches{/branch}","tags_url":"https://api.github.com/repos/spacejam/mesos_state/tags","blobs_url":"https://api.github.com/repos/spacejam/mesos_state/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacejam/mesos_state/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacejam/mesos_state/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacejam/mesos_state/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacejam/mesos_state/statuses/{sha}","languages_url":"https://api.github.com/repos/spacejam/mesos_state/languages","stargazers_url":"https://api.github.com/repos/spacejam/mesos_state/stargazers","contributors_url":"https://api.github.com/repos/spacejam/mesos_state/contributors","subscribers_url":"https://api.github.com/repos/spacejam/mesos_state/subscribers","subscription_url":"https://api.github.com/repos/spacejam/mesos_state/subscription","commits_url":"https://api.github.com/repos/spacejam/mesos_state/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacejam/mesos_state/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacejam/mesos_state/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacejam/mesos_state/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacejam/mesos_state/contents/{+path}","compare_url":"https://api.github.com/repos/spacejam/mesos_state/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacejam/mesos_state/merges","archive_url":"https://api.github.com/repos/spacejam/mesos_state/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacejam/mesos_state/downloads","issues_url":"https://api.github.com/repos/spacejam/mesos_state/issues{/number}","pulls_url":"https://api.github.com/repos/spacejam/mesos_state/pulls{/number}","milestones_url":"https://api.github.com/repos/spacejam/mesos_state/milestones{/number}","notifications_url":"https://api.github.com/repos/spacejam/mesos_state/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacejam/mesos_state/labels{/name}","releases_url":"https://api.github.com/repos/spacejam/mesos_state/releases{/id}","deployments_url":"https://api.github.com/repos/spacejam/mesos_state/deployments","created_at":"2016-06-20T17:22:53Z","updated_at":"2016-06-20T17:22:54Z","pushed_at":"2016-06-21T19:18:06Z","git_url":"git://github.com/spacejam/mesos_state.git","ssh_url":"git@github.com:spacejam/mesos_state.git","clone_url":"https://github.com/spacejam/mesos_state.git","svn_url":"https://github.com/spacejam/mesos_state","homepage":null,"size":1250,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dcos:master","ref":"master","sha":"791ad6922aa94b5fe61896db32f02c9e681332d1","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":58593605,"name":"mesos_state","full_name":"dcos/mesos_state","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/mesos_state","description":"","fork":false,"url":"https://api.github.com/repos/dcos/mesos_state","forks_url":"https://api.github.com/repos/dcos/mesos_state/forks","keys_url":"https://api.github.com/repos/dcos/mesos_state/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/mesos_state/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/mesos_state/teams","hooks_url":"https://api.github.com/repos/dcos/mesos_state/hooks","issue_events_url":"https://api.github.com/repos/dcos/mesos_state/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/mesos_state/events","assignees_url":"https://api.github.com/repos/dcos/mesos_state/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/mesos_state/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/mesos_state/tags","blobs_url":"https://api.github.com/repos/dcos/mesos_state/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/mesos_state/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/mesos_state/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/mesos_state/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/mesos_state/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/mesos_state/languages","stargazers_url":"https://api.github.com/repos/dcos/mesos_state/stargazers","contributors_url":"https://api.github.com/repos/dcos/mesos_state/contributors","subscribers_url":"https://api.github.com/repos/dcos/mesos_state/subscribers","subscription_url":"https://api.github.com/repos/dcos/mesos_state/subscription","commits_url":"https://api.github.com/repos/dcos/mesos_state/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/mesos_state/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/mesos_state/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/mesos_state/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/mesos_state/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/mesos_state/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/mesos_state/merges","archive_url":"https://api.github.com/repos/dcos/mesos_state/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/mesos_state/downloads","issues_url":"https://api.github.com/repos/dcos/mesos_state/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/mesos_state/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/mesos_state/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/mesos_state/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/mesos_state/labels{/name}","releases_url":"https://api.github.com/repos/dcos/mesos_state/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/mesos_state/deployments","created_at":"2016-05-12T00:29:50Z","updated_at":"2016-05-12T00:38:28Z","pushed_at":"2016-06-21T19:18:06Z","git_url":"git://github.com/dcos/mesos_state.git","ssh_url":"git@github.com:dcos/mesos_state.git","clone_url":"https://github.com/dcos/mesos_state.git","svn_url":"https://github.com/dcos/mesos_state","homepage":null,"size":1247,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/9"},"html":{"href":"https://github.com/dcos/mesos_state/pull/9"},"issue":{"href":"https://api.github.com/repos/dcos/mesos_state/issues/9"},"comments":{"href":"https://api.github.com/repos/dcos/mesos_state/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dcos/mesos_state/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/dcos/mesos_state/statuses/b2d85205755f84ac005fa2d6a598726e8da13ef2"}}}}
{"actor":{"display_login":"sargun"}}