{"action":"created","comment":{"url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/comments/239986667","pull_request_review_id":182924469,"id":239986667,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTk4NjY2Nw==","diff_hunk":"@@ -113,6 +113,36 @@ func servePhabricatorRepoCreate(w http.ResponseWriter, r *http.Request) error {\n \treturn nil\n }\n \n+// serveExternalServiceConfigs serves a JSON response that is an array of all\n+// external service configs that match the requested kind.\n+func serveExternalServiceConfigs(w http.ResponseWriter, r *http.Request) error {\n+\tvar req api.ExternalServiceConfigsRequest\n+\terr := json.NewDecoder(r.Body).Decode(&req)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tservices, err := db.ExternalServices.List(r.Context(), db.ExternalServicesListOptions{Kind: req.Kind})\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// Instead of returning an intermediate response type, we directly return\n+\t// the array of configs (which are themselves JSON objects).\n+\t// This makes it possible for the caller to directly unmarshal the response into\n+\t// a slice of connection configurations for this external service kind.\n+\tconfigs := make([]map[string]interface{}, 0, len(services))\n+\tfor _, service := range services {\n+\t\tvar config map[string]interface{}\n+\t\t// Raw configs may have comments in them so we have to use a json parser\n+\t\t// that supports comments in json.\n+\t\tif err := jsonc.Unmarshal(service.Config, &config); err != nil {\n+\t\t\treturn err","path":"cmd/frontend/internal/httpapi/internal.go","position":null,"original_position":27,"commit_id":"451b7ce738f04252877bb25d9c83e32c67109d5f","original_commit_id":"47c6ed3e6542c198927ecc55ba66f5f329d81883","user":{"login":"nicksnyder","id":754768,"node_id":"MDQ6VXNlcjc1NDc2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/754768?v=4","gravatar_id":"","url":"https://api.github.com/users/nicksnyder","html_url":"https://github.com/nicksnyder","followers_url":"https://api.github.com/users/nicksnyder/followers","following_url":"https://api.github.com/users/nicksnyder/following{/other_user}","gists_url":"https://api.github.com/users/nicksnyder/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksnyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksnyder/subscriptions","organizations_url":"https://api.github.com/users/nicksnyder/orgs","repos_url":"https://api.github.com/users/nicksnyder/repos","events_url":"https://api.github.com/users/nicksnyder/events{/privacy}","received_events_url":"https://api.github.com/users/nicksnyder/received_events","type":"User","site_admin":false},"body":"Oh, I don't think we can use it because we need to support invalid JSON (e.g. comments, not strict comments).\r\n\r\n> jsonb does not preserve semantically-insignificant details such as whitespace","created_at":"2018-12-08T01:17:09Z","updated_at":"2018-12-08T01:17:09Z","html_url":"https://github.com/sourcegraph/sourcegraph/pull/1160#discussion_r239986667","pull_request_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/comments/239986667"},"html":{"href":"https://github.com/sourcegraph/sourcegraph/pull/1160#discussion_r239986667"},"pull_request":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160"}},"in_reply_to_id":239970895},"pull_request":{"url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160","id":234380011,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0MzgwMDEx","html_url":"https://github.com/sourcegraph/sourcegraph/pull/1160","diff_url":"https://github.com/sourcegraph/sourcegraph/pull/1160.diff","patch_url":"https://github.com/sourcegraph/sourcegraph/pull/1160.patch","issue_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1160","number":1160,"state":"open","locked":false,"title":"wip: Load code host config from external services database","user":{"login":"nicksnyder","id":754768,"node_id":"MDQ6VXNlcjc1NDc2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/754768?v=4","gravatar_id":"","url":"https://api.github.com/users/nicksnyder","html_url":"https://github.com/nicksnyder","followers_url":"https://api.github.com/users/nicksnyder/followers","following_url":"https://api.github.com/users/nicksnyder/following{/other_user}","gists_url":"https://api.github.com/users/nicksnyder/gists{/gist_id}","starred_url":"https://api.github.com/users/nicksnyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicksnyder/subscriptions","organizations_url":"https://api.github.com/users/nicksnyder/orgs","repos_url":"https://api.github.com/users/nicksnyder/repos","events_url":"https://api.github.com/users/nicksnyder/events{/privacy}","received_events_url":"https://api.github.com/users/nicksnyder/received_events","type":"User","site_admin":false},"body":"part of https://github.com/sourcegraph/sourcegraph/issues/914\r\n\r\nAdds a codepath to read configuration information from the database when a feature flag is enabled.\r\n\r\nTODO\r\n- [ ] Audit all calls to conf.Get() for each code host (e.g. https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/pkg/conf/computed.go#L108)","created_at":"2018-11-28T18:27:29Z","updated_at":"2018-12-08T01:17:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"979f0dc5ec16c186dbea7663ed5231db421fafc0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160/commits","review_comments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160/comments","review_comment_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1160/comments","statuses_url":"https://api.github.com/repos/sourcegraph/sourcegraph/statuses/451b7ce738f04252877bb25d9c83e32c67109d5f","head":{"label":"sourcegraph:phab2","ref":"phab2","sha":"451b7ce738f04252877bb25d9c83e32c67109d5f","user":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":41288708,"node_id":"MDEwOlJlcG9zaXRvcnk0MTI4ODcwOA==","name":"sourcegraph","full_name":"sourcegraph/sourcegraph","private":false,"owner":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sourcegraph/sourcegraph","description":"Code search and intelligence, self-hosted and scalable","fork":false,"url":"https://api.github.com/repos/sourcegraph/sourcegraph","forks_url":"https://api.github.com/repos/sourcegraph/sourcegraph/forks","keys_url":"https://api.github.com/repos/sourcegraph/sourcegraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/sourcegraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/sourcegraph/teams","hooks_url":"https://api.github.com/repos/sourcegraph/sourcegraph/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/sourcegraph/events","assignees_url":"https://api.github.com/repos/sourcegraph/sourcegraph/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/sourcegraph/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/sourcegraph/tags","blobs_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/sourcegraph/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/sourcegraph/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/sourcegraph/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/sourcegraph/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/sourcegraph/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/sourcegraph/subscription","commits_url":"https://api.github.com/repos/sourcegraph/sourcegraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/sourcegraph/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/sourcegraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/sourcegraph/merges","archive_url":"https://api.github.com/repos/sourcegraph/sourcegraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/sourcegraph/downloads","issues_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/sourcegraph/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/sourcegraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/sourcegraph/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/sourcegraph/releases{/id}","deployments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/deployments","created_at":"2015-08-24T07:27:28Z","updated_at":"2018-12-08T00:39:32Z","pushed_at":"2018-12-08T01:10:14Z","git_url":"git://github.com/sourcegraph/sourcegraph.git","ssh_url":"git@github.com:sourcegraph/sourcegraph.git","clone_url":"https://github.com/sourcegraph/sourcegraph.git","svn_url":"https://github.com/sourcegraph/sourcegraph","homepage":"https://sourcegraph.com","size":46792,"stargazers_count":828,"watchers_count":828,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":43,"mirror_url":null,"archived":false,"open_issues_count":426,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":43,"open_issues":426,"watchers":828,"default_branch":"master"}},"base":{"label":"sourcegraph:master","ref":"master","sha":"8c3587ae0f0b4e501a7b57702dec08563365f5d2","user":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":41288708,"node_id":"MDEwOlJlcG9zaXRvcnk0MTI4ODcwOA==","name":"sourcegraph","full_name":"sourcegraph/sourcegraph","private":false,"owner":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sourcegraph/sourcegraph","description":"Code search and intelligence, self-hosted and scalable","fork":false,"url":"https://api.github.com/repos/sourcegraph/sourcegraph","forks_url":"https://api.github.com/repos/sourcegraph/sourcegraph/forks","keys_url":"https://api.github.com/repos/sourcegraph/sourcegraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/sourcegraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/sourcegraph/teams","hooks_url":"https://api.github.com/repos/sourcegraph/sourcegraph/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/sourcegraph/events","assignees_url":"https://api.github.com/repos/sourcegraph/sourcegraph/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/sourcegraph/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/sourcegraph/tags","blobs_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/sourcegraph/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/sourcegraph/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/sourcegraph/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/sourcegraph/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/sourcegraph/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/sourcegraph/subscription","commits_url":"https://api.github.com/repos/sourcegraph/sourcegraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/sourcegraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/sourcegraph/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/sourcegraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/sourcegraph/merges","archive_url":"https://api.github.com/repos/sourcegraph/sourcegraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/sourcegraph/downloads","issues_url":"https://api.github.com/repos/sourcegraph/sourcegraph/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/sourcegraph/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/sourcegraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/sourcegraph/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/sourcegraph/releases{/id}","deployments_url":"https://api.github.com/repos/sourcegraph/sourcegraph/deployments","created_at":"2015-08-24T07:27:28Z","updated_at":"2018-12-08T00:39:32Z","pushed_at":"2018-12-08T01:10:14Z","git_url":"git://github.com/sourcegraph/sourcegraph.git","ssh_url":"git@github.com:sourcegraph/sourcegraph.git","clone_url":"https://github.com/sourcegraph/sourcegraph.git","svn_url":"https://github.com/sourcegraph/sourcegraph","homepage":"https://sourcegraph.com","size":46792,"stargazers_count":828,"watchers_count":828,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":43,"mirror_url":null,"archived":false,"open_issues_count":426,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":43,"open_issues":426,"watchers":828,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160"},"html":{"href":"https://github.com/sourcegraph/sourcegraph/pull/1160"},"issue":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1160"},"comments":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/issues/1160/comments"},"review_comments":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160/comments"},"review_comment":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/pulls/1160/commits"},"statuses":{"href":"https://api.github.com/repos/sourcegraph/sourcegraph/statuses/451b7ce738f04252877bb25d9c83e32c67109d5f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"nicksnyder"}}