{"action":"created","comment":{"url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments/79015817","id":79015817,"diff_hunk":"@@ -64,7 +65,18 @@ public ISecretReader CreateSecretReader(IGalleryConfigurationService configurati\n                 secretReader = new EmptySecretReader();\n             }\n \n-            return new CachingSecretReader(secretReader, _diagnosticsService);\n+            int cacheRefreshIntervalSeconds;\n+            try\n+            {\n+                cacheRefreshIntervalSeconds = int.Parse(configurationService.ReadSetting(\n+                    string.Format(CultureInfo.InvariantCulture, \"{0}{1}\", KeyVaultConfigurationPrefix, CacheRefreshInterval)).Result);","path":"src/NuGetGallery/Configuration/SecretReader/SecretReaderFactory.cs","position":17,"original_position":17,"commit_id":"1ec2698e557de55d108a248ab2b839193bf52fdb","original_commit_id":"7a4e23c683b144663b426f8aa0499be778c1c269","user":{"login":"skofman1","id":16807822,"avatar_url":"https://avatars.githubusercontent.com/u/16807822?v=3","gravatar_id":"","url":"https://api.github.com/users/skofman1","html_url":"https://github.com/skofman1","followers_url":"https://api.github.com/users/skofman1/followers","following_url":"https://api.github.com/users/skofman1/following{/other_user}","gists_url":"https://api.github.com/users/skofman1/gists{/gist_id}","starred_url":"https://api.github.com/users/skofman1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skofman1/subscriptions","organizations_url":"https://api.github.com/users/skofman1/orgs","repos_url":"https://api.github.com/users/skofman1/repos","events_url":"https://api.github.com/users/skofman1/events{/privacy}","received_events_url":"https://api.github.com/users/skofman1/received_events","type":"User","site_admin":false},"body":"dont fallback on int parse behavior: if the user wrote something bad in the config, startup should fail. If the config does not exist - use default. ","created_at":"2016-09-15T17:16:32Z","updated_at":"2016-09-15T17:16:32Z","html_url":"https://github.com/NuGet/NuGetGallery/pull/3213#discussion_r79015817","pull_request_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213","_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments/79015817"},"html":{"href":"https://github.com/NuGet/NuGetGallery/pull/3213#discussion_r79015817"},"pull_request":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213"}}},"pull_request":{"url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213","id":82627954,"html_url":"https://github.com/NuGet/NuGetGallery/pull/3213","diff_url":"https://github.com/NuGet/NuGetGallery/pull/3213.diff","patch_url":"https://github.com/NuGet/NuGetGallery/pull/3213.patch","issue_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3213","number":3213,"state":"open","locked":false,"title":"Key rotation logic for the gallery","user":{"login":"scottbommarito","id":18014088,"avatar_url":"https://avatars.githubusercontent.com/u/18014088?v=3","gravatar_id":"","url":"https://api.github.com/users/scottbommarito","html_url":"https://github.com/scottbommarito","followers_url":"https://api.github.com/users/scottbommarito/followers","following_url":"https://api.github.com/users/scottbommarito/following{/other_user}","gists_url":"https://api.github.com/users/scottbommarito/gists{/gist_id}","starred_url":"https://api.github.com/users/scottbommarito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottbommarito/subscriptions","organizations_url":"https://api.github.com/users/scottbommarito/orgs","repos_url":"https://api.github.com/users/scottbommarito/repos","events_url":"https://api.github.com/users/scottbommarito/events{/privacy}","received_events_url":"https://api.github.com/users/scottbommarito/received_events","type":"User","site_admin":false},"body":"Sorry about the frightening size of this PR. Fortunately, most of the edits are menial and repetitious. I'll summarize it here and provide some links to the important code sections to make reading this much easier.\r\n\r\nThere are really three major changes that I made here.\r\n\r\n1. [No classes store a reference to `IAppConfiguration`.](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-67ba3e88d5d0280eb9eca28837cf243bR17) Any classes that stored a reference to `IAppConfiguration` before now store a reference to `IGalleryConfigurationService` and get the `IAppConfiguration` from there.\r\n\r\n2. `IGalleryConfigurationService` no longer creates a single `IAppConfiguration` on initialization and then passes out references to it. [Instead, it recreates the object every time `GetCurrent()` or `GetFeatures()` is called.](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-3a73a77c6ab652df243e040f87bd23b1R59) This is generally a fast operation--everything is in memory, so it is only performing memory look-ups.\r\n\r\n3. Upon recreating the `IAppConfiguration`, [at an interval that can be set in the config](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-3705f05c9224ca5ded26fd7021b93e03R137), [we re-inject the secrets from `KeyVault`](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-c3438d9f0ffdc96b6d0ce3087c880cceR44), refreshing them.\r\n\r\nSo, why is this PR so big?\r\n\r\n1. A number of classes still consumed `IAppConfiguration` directly. Each had to be edited.\r\n\r\n2. Since `IAppConfiguration` is recreated on every use, which requires the use of `ISecretReader.GetSecretAsync`, each use of `IGalleryConfigurationService.GetCurrent` must now be in an async context. This provided several difficulties and a large amount of small code changes.\r\n\r\nLinks to other interesting changes:\r\n\r\n- [Unit test for cache secret reader updating with new value.](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-4db3d6e9f90f611e7373d382b0e49074R36)\r\n- [Adding the current config to the ViewBag for all views because it was required by some widely-used partials.](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-cd1cf9a9eb05538013c8c1a51de26409R71)\r\n- [ConfigObjectDelegate](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-db377aa9c74d4a8d562b8fc0b2048039R9), as used to refresh the [ErrorLog singletons](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-209bbd64fe33b575fdc485af9b3f5452R56) and [CloudAuditingService](https://github.com/NuGet/NuGetGallery/pull/3213/files#diff-209bbd64fe33b575fdc485af9b3f5452R421).\r\n\r\nTODO:\r\n\r\n- [x] fix merge conflicts\r\n- [ ] create more unit tests to verify the secrets are being correctly rotated\r\n- [ ] add the new config to both dev, int, and prod\r\n","created_at":"2016-08-24T22:22:54Z","updated_at":"2016-09-15T17:16:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e451f36ec97105446a1ac75b67991dd1168add48","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213/commits","review_comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213/comments","review_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3213/comments","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/1ec2698e557de55d108a248ab2b839193bf52fdb","head":{"label":"NuGet:my-big-fat-key-rotation2","ref":"my-big-fat-key-rotation2","sha":"1ec2698e557de55d108a248ab2b839193bf52fdb","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":2180736,"name":"NuGetGallery","full_name":"NuGet/NuGetGallery","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGetGallery","description":"The NuGet Gallery","fork":false,"url":"https://api.github.com/repos/NuGet/NuGetGallery","forks_url":"https://api.github.com/repos/NuGet/NuGetGallery/forks","keys_url":"https://api.github.com/repos/NuGet/NuGetGallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGetGallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGetGallery/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGetGallery/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGetGallery/events","assignees_url":"https://api.github.com/repos/NuGet/NuGetGallery/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGetGallery/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGetGallery/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGetGallery/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGetGallery/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGetGallery/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGetGallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGetGallery/merges","archive_url":"https://api.github.com/repos/NuGet/NuGetGallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGetGallery/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGetGallery/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGetGallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGetGallery/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGetGallery/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/NuGetGallery/deployments","created_at":"2011-08-09T17:57:32Z","updated_at":"2016-09-15T07:57:11Z","pushed_at":"2016-09-15T07:09:09Z","git_url":"git://github.com/NuGet/NuGetGallery.git","ssh_url":"git@github.com:NuGet/NuGetGallery.git","clone_url":"https://github.com/NuGet/NuGetGallery.git","svn_url":"https://github.com/NuGet/NuGetGallery","homepage":"http://www.nuget.org","size":63480,"stargazers_count":781,"watchers_count":781,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":449,"mirror_url":null,"open_issues_count":231,"forks":449,"open_issues":231,"watchers":781,"default_branch":"master"}},"base":{"label":"NuGet:dev","ref":"dev","sha":"deac8c375b0672baabc45d930b98cc4285519609","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":2180736,"name":"NuGetGallery","full_name":"NuGet/NuGetGallery","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars.githubusercontent.com/u/968310?v=3","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/NuGetGallery","description":"The NuGet Gallery","fork":false,"url":"https://api.github.com/repos/NuGet/NuGetGallery","forks_url":"https://api.github.com/repos/NuGet/NuGetGallery/forks","keys_url":"https://api.github.com/repos/NuGet/NuGetGallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/NuGetGallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/NuGetGallery/teams","hooks_url":"https://api.github.com/repos/NuGet/NuGetGallery/hooks","issue_events_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/NuGetGallery/events","assignees_url":"https://api.github.com/repos/NuGet/NuGetGallery/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/NuGetGallery/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/tags","blobs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/NuGetGallery/languages","stargazers_url":"https://api.github.com/repos/NuGet/NuGetGallery/stargazers","contributors_url":"https://api.github.com/repos/NuGet/NuGetGallery/contributors","subscribers_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscribers","subscription_url":"https://api.github.com/repos/NuGet/NuGetGallery/subscription","commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/NuGetGallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/NuGetGallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/NuGetGallery/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/NuGetGallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/NuGetGallery/merges","archive_url":"https://api.github.com/repos/NuGet/NuGetGallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/NuGetGallery/downloads","issues_url":"https://api.github.com/repos/NuGet/NuGetGallery/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/NuGetGallery/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/NuGetGallery/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/NuGetGallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/NuGetGallery/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/NuGetGallery/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/NuGetGallery/deployments","created_at":"2011-08-09T17:57:32Z","updated_at":"2016-09-15T07:57:11Z","pushed_at":"2016-09-15T07:09:09Z","git_url":"git://github.com/NuGet/NuGetGallery.git","ssh_url":"git@github.com:NuGet/NuGetGallery.git","clone_url":"https://github.com/NuGet/NuGetGallery.git","svn_url":"https://github.com/NuGet/NuGetGallery","homepage":"http://www.nuget.org","size":63480,"stargazers_count":781,"watchers_count":781,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":449,"mirror_url":null,"open_issues_count":231,"forks":449,"open_issues":231,"watchers":781,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213"},"html":{"href":"https://github.com/NuGet/NuGetGallery/pull/3213"},"issue":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3213"},"comments":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/issues/3213/comments"},"review_comments":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213/comments"},"review_comment":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/pulls/3213/commits"},"statuses":{"href":"https://api.github.com/repos/NuGet/NuGetGallery/statuses/1ec2698e557de55d108a248ab2b839193bf52fdb"}}}}
{"actor":{"display_login":"skofman1"}}