{"action":"created","comment":{"url":"https://api.github.com/repos/deconst/presenter/pulls/comments/27219091","id":27219091,"diff_hunk":"@@ -5,91 +5,19 @@\n *\n */\n \n-function normalize_url(url) {\n-  if (url.slice(-1) == '/') {\n-    return url.slice(0, -1);\n-  }\n-  return url;\n-}\n+var\n+  express = require('express'),\n+  exphbs  = require('express-handlebars'),\n+  config = require('./src/config'),\n+  routes = require('./src/routes');\n \n-var mapping_service_url;\n-var content_service_url;\n-var presented_url_domain = process.env.PRESENTED_URL_DOMAIN;\n-\n-// TODO: create function that long-polls and waits for an etcd key change, then calls\n-// get_mapping_service_url() and get_content_service_url() to update the\n-// mapping_service_url and content_service_url vars.\n-\n-function set_mapping_service_url() {\n-  // TODO: replace process.env with etcd call\n-  mapping_service_url = normalize_url(process.env.MAPPING_SERVICE_URL);\n-}\n-\n-function set_content_service_url() {\n-  // TODO: replace process.env with etcd call\n-  content_service_url = normalize_url(process.env.CONTENT_SERVICE_URL);\n-}\n-\n-// Derive the presented URL for a specific request, honoring the presented_url_domain setting if\n-// one is provided.\n-function presented_url(req) {\n-  var domain = presented_url_domain ? presented_url_domain : req.hostname;\n-  return \"https://\" + domain + req.path;\n-}\n-\n-set_mapping_service_url();\n-set_content_service_url();\n-\n-var request = require('request'),\n-    urljoin = require('url-join'),\n-    express = require('express'),\n-    exphbs  = require('express-handlebars');\n+config.configure(process.env);","path":"app.js","position":48,"original_position":48,"commit_id":"1bf357552ba5976d8057ef845b36aae79789faa2","original_commit_id":"1bf357552ba5976d8057ef845b36aae79789faa2","user":{"login":"kenperkins","id":730664,"avatar_url":"https://avatars.githubusercontent.com/u/730664?v=3","gravatar_id":"","url":"https://api.github.com/users/kenperkins","html_url":"https://github.com/kenperkins","followers_url":"https://api.github.com/users/kenperkins/followers","following_url":"https://api.github.com/users/kenperkins/following{/other_user}","gists_url":"https://api.github.com/users/kenperkins/gists{/gist_id}","starred_url":"https://api.github.com/users/kenperkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenperkins/subscriptions","organizations_url":"https://api.github.com/users/kenperkins/orgs","repos_url":"https://api.github.com/users/kenperkins/repos","events_url":"https://api.github.com/users/kenperkins/events{/privacy}","received_events_url":"https://api.github.com/users/kenperkins/received_events","type":"User","site_admin":false},"body":"Why pass `process.env` here?","created_at":"2015-03-26T14:49:46Z","updated_at":"2015-03-26T14:49:46Z","html_url":"https://github.com/deconst/presenter/pull/6#discussion_r27219091","pull_request_url":"https://api.github.com/repos/deconst/presenter/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/deconst/presenter/pulls/comments/27219091"},"html":{"href":"https://github.com/deconst/presenter/pull/6#discussion_r27219091"},"pull_request":{"href":"https://api.github.com/repos/deconst/presenter/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/deconst/presenter/pulls/6","id":32018094,"html_url":"https://github.com/deconst/presenter/pull/6","diff_url":"https://github.com/deconst/presenter/pull/6.diff","patch_url":"https://github.com/deconst/presenter/pull/6.patch","issue_url":"https://api.github.com/repos/deconst/presenter/issues/6","number":6,"state":"open","locked":false,"title":"[wip] Refactor the presenter","user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"body":"Break `app.js` into a few smaller files. Tease apart some of the callback triangle-of-doom in the content handler.","created_at":"2015-03-26T13:43:38Z","updated_at":"2015-03-26T14:49:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7740e315003569a4451f0069e5afce7b1ed2aab7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/deconst/presenter/pulls/6/commits","review_comments_url":"https://api.github.com/repos/deconst/presenter/pulls/6/comments","review_comment_url":"https://api.github.com/repos/deconst/presenter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/deconst/presenter/issues/6/comments","statuses_url":"https://api.github.com/repos/deconst/presenter/statuses/1bf357552ba5976d8057ef845b36aae79789faa2","head":{"label":"smashwilson:refactor","ref":"refactor","sha":"1bf357552ba5976d8057ef845b36aae79789faa2","user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"repo":{"id":32808003,"name":"deconst-presenter","full_name":"smashwilson/deconst-presenter","owner":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars.githubusercontent.com/u/17565?v=3","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smashwilson/deconst-presenter","description":"A component that builds and returns the final document.","fork":true,"url":"https://api.github.com/repos/smashwilson/deconst-presenter","forks_url":"https://api.github.com/repos/smashwilson/deconst-presenter/forks","keys_url":"https://api.github.com/repos/smashwilson/deconst-presenter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smashwilson/deconst-presenter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smashwilson/deconst-presenter/teams","hooks_url":"https://api.github.com/repos/smashwilson/deconst-presenter/hooks","issue_events_url":"https://api.github.com/repos/smashwilson/deconst-presenter/issues/events{/number}","events_url":"https://api.github.com/repos/smashwilson/deconst-presenter/events","assignees_url":"https://api.github.com/repos/smashwilson/deconst-presenter/assignees{/user}","branches_url":"https://api.github.com/repos/smashwilson/deconst-presenter/branches{/branch}","tags_url":"https://api.github.com/repos/smashwilson/deconst-presenter/tags","blobs_url":"https://api.github.com/repos/smashwilson/deconst-presenter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smashwilson/deconst-presenter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smashwilson/deconst-presenter/git/refs{/sha}","trees_url":"https://api.github.com/repos/smashwilson/deconst-presenter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smashwilson/deconst-presenter/statuses/{sha}","languages_url":"https://api.github.com/repos/smashwilson/deconst-presenter/languages","stargazers_url":"https://api.github.com/repos/smashwilson/deconst-presenter/stargazers","contributors_url":"https://api.github.com/repos/smashwilson/deconst-presenter/contributors","subscribers_url":"https://api.github.com/repos/smashwilson/deconst-presenter/subscribers","subscription_url":"https://api.github.com/repos/smashwilson/deconst-presenter/subscription","commits_url":"https://api.github.com/repos/smashwilson/deconst-presenter/commits{/sha}","git_commits_url":"https://api.github.com/repos/smashwilson/deconst-presenter/git/commits{/sha}","comments_url":"https://api.github.com/repos/smashwilson/deconst-presenter/comments{/number}","issue_comment_url":"https://api.github.com/repos/smashwilson/deconst-presenter/issues/comments{/number}","contents_url":"https://api.github.com/repos/smashwilson/deconst-presenter/contents/{+path}","compare_url":"https://api.github.com/repos/smashwilson/deconst-presenter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smashwilson/deconst-presenter/merges","archive_url":"https://api.github.com/repos/smashwilson/deconst-presenter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smashwilson/deconst-presenter/downloads","issues_url":"https://api.github.com/repos/smashwilson/deconst-presenter/issues{/number}","pulls_url":"https://api.github.com/repos/smashwilson/deconst-presenter/pulls{/number}","milestones_url":"https://api.github.com/repos/smashwilson/deconst-presenter/milestones{/number}","notifications_url":"https://api.github.com/repos/smashwilson/deconst-presenter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smashwilson/deconst-presenter/labels{/name}","releases_url":"https://api.github.com/repos/smashwilson/deconst-presenter/releases{/id}","created_at":"2015-03-24T15:39:14Z","updated_at":"2015-03-24T15:41:21Z","pushed_at":"2015-03-26T14:12:37Z","git_url":"git://github.com/smashwilson/deconst-presenter.git","ssh_url":"git@github.com:smashwilson/deconst-presenter.git","clone_url":"https://github.com/smashwilson/deconst-presenter.git","svn_url":"https://github.com/smashwilson/deconst-presenter","homepage":null,"size":83,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"deconst:master","ref":"master","sha":"3d0334b54bb9750a4cba2bf8eee70fa310bfc778","user":{"login":"deconst","id":11205298,"avatar_url":"https://avatars.githubusercontent.com/u/11205298?v=3","gravatar_id":"","url":"https://api.github.com/users/deconst","html_url":"https://github.com/deconst","followers_url":"https://api.github.com/users/deconst/followers","following_url":"https://api.github.com/users/deconst/following{/other_user}","gists_url":"https://api.github.com/users/deconst/gists{/gist_id}","starred_url":"https://api.github.com/users/deconst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deconst/subscriptions","organizations_url":"https://api.github.com/users/deconst/orgs","repos_url":"https://api.github.com/users/deconst/repos","events_url":"https://api.github.com/users/deconst/events{/privacy}","received_events_url":"https://api.github.com/users/deconst/received_events","type":"Organization","site_admin":false},"repo":{"id":32496221,"name":"presenter","full_name":"deconst/presenter","owner":{"login":"deconst","id":11205298,"avatar_url":"https://avatars.githubusercontent.com/u/11205298?v=3","gravatar_id":"","url":"https://api.github.com/users/deconst","html_url":"https://github.com/deconst","followers_url":"https://api.github.com/users/deconst/followers","following_url":"https://api.github.com/users/deconst/following{/other_user}","gists_url":"https://api.github.com/users/deconst/gists{/gist_id}","starred_url":"https://api.github.com/users/deconst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deconst/subscriptions","organizations_url":"https://api.github.com/users/deconst/orgs","repos_url":"https://api.github.com/users/deconst/repos","events_url":"https://api.github.com/users/deconst/events{/privacy}","received_events_url":"https://api.github.com/users/deconst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/deconst/presenter","description":"A component that builds and returns the final document.","fork":false,"url":"https://api.github.com/repos/deconst/presenter","forks_url":"https://api.github.com/repos/deconst/presenter/forks","keys_url":"https://api.github.com/repos/deconst/presenter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deconst/presenter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deconst/presenter/teams","hooks_url":"https://api.github.com/repos/deconst/presenter/hooks","issue_events_url":"https://api.github.com/repos/deconst/presenter/issues/events{/number}","events_url":"https://api.github.com/repos/deconst/presenter/events","assignees_url":"https://api.github.com/repos/deconst/presenter/assignees{/user}","branches_url":"https://api.github.com/repos/deconst/presenter/branches{/branch}","tags_url":"https://api.github.com/repos/deconst/presenter/tags","blobs_url":"https://api.github.com/repos/deconst/presenter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deconst/presenter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deconst/presenter/git/refs{/sha}","trees_url":"https://api.github.com/repos/deconst/presenter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deconst/presenter/statuses/{sha}","languages_url":"https://api.github.com/repos/deconst/presenter/languages","stargazers_url":"https://api.github.com/repos/deconst/presenter/stargazers","contributors_url":"https://api.github.com/repos/deconst/presenter/contributors","subscribers_url":"https://api.github.com/repos/deconst/presenter/subscribers","subscription_url":"https://api.github.com/repos/deconst/presenter/subscription","commits_url":"https://api.github.com/repos/deconst/presenter/commits{/sha}","git_commits_url":"https://api.github.com/repos/deconst/presenter/git/commits{/sha}","comments_url":"https://api.github.com/repos/deconst/presenter/comments{/number}","issue_comment_url":"https://api.github.com/repos/deconst/presenter/issues/comments{/number}","contents_url":"https://api.github.com/repos/deconst/presenter/contents/{+path}","compare_url":"https://api.github.com/repos/deconst/presenter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deconst/presenter/merges","archive_url":"https://api.github.com/repos/deconst/presenter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deconst/presenter/downloads","issues_url":"https://api.github.com/repos/deconst/presenter/issues{/number}","pulls_url":"https://api.github.com/repos/deconst/presenter/pulls{/number}","milestones_url":"https://api.github.com/repos/deconst/presenter/milestones{/number}","notifications_url":"https://api.github.com/repos/deconst/presenter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deconst/presenter/labels{/name}","releases_url":"https://api.github.com/repos/deconst/presenter/releases{/id}","created_at":"2015-03-19T02:28:24Z","updated_at":"2015-03-25T19:20:12Z","pushed_at":"2015-03-26T14:12:37Z","git_url":"git://github.com/deconst/presenter.git","ssh_url":"git@github.com:deconst/presenter.git","clone_url":"https://github.com/deconst/presenter.git","svn_url":"https://github.com/deconst/presenter","homepage":null,"size":188,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/deconst/presenter/pulls/6"},"html":{"href":"https://github.com/deconst/presenter/pull/6"},"issue":{"href":"https://api.github.com/repos/deconst/presenter/issues/6"},"comments":{"href":"https://api.github.com/repos/deconst/presenter/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/deconst/presenter/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/deconst/presenter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/deconst/presenter/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/deconst/presenter/statuses/1bf357552ba5976d8057ef845b36aae79789faa2"}}}}