{"action":"created","comment":{"url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/comments/60481512","id":60481512,"diff_hunk":"@@ -0,0 +1,74 @@\n+require 'spec_helper'\n+\n+RSpec.describe SSLContext do\n+  describe 'when SSL ENV variables are not set' do\n+    describe '.to_h' do\n+      it 'returns nil when initilized without parameters' do\n+        context = SSLContext.new\n+\n+        expect(context.to_h).to be_nil\n+      end\n+\n+      it 'returns a hash the same hash when all variables are defined' do\n+        ssl_context_hash = {\n+          key: 'key',\n+          certificate: 'certificate',\n+          ca_certificate: 'ca_certificate',\n+        }\n+        context = SSLContext.new(ssl_context_hash)\n+\n+        expect(context.to_h).to eq(ssl_context_hash)\n+      end\n+\n+      it 'does not add keys with nil values' do\n+        ssl_context_hash = {\n+          key: 'key',\n+          certificate: 'certificate',\n+        }\n+        context = SSLContext.new(ssl_context_hash)\n+        ca_certificate = context.to_h[:ca_certificate]\n+\n+        expect(ca_certificate).to be_nil\n+      end\n+    end\n+  end\n+\n+  describe 'when SSL ENV variables are set' do\n+    before do\n+      ENV['NSQ_SSL_KEY'] = '/some/key'","path":"spec/lib/fastly_nsq/ssl_context_spec.rb","position":38,"original_position":38,"commit_id":"4433a5dffb26a1acbc5258597c84286b05d1800d","original_commit_id":"6e4f2db2f9c97772765b902f3c65a5fcc1912e6e","user":{"login":"alieander","id":177143,"avatar_url":"https://avatars.githubusercontent.com/u/177143?v=3","gravatar_id":"","url":"https://api.github.com/users/alieander","html_url":"https://github.com/alieander","followers_url":"https://api.github.com/users/alieander/followers","following_url":"https://api.github.com/users/alieander/following{/other_user}","gists_url":"https://api.github.com/users/alieander/gists{/gist_id}","starred_url":"https://api.github.com/users/alieander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alieander/subscriptions","organizations_url":"https://api.github.com/users/alieander/orgs","repos_url":"https://api.github.com/users/alieander/repos","events_url":"https://api.github.com/users/alieander/events{/privacy}","received_events_url":"https://api.github.com/users/alieander/received_events","type":"User","site_admin":false},"body":"allow ENV doesn't seem to work well with multiple things needing to be mocked out.","created_at":"2016-04-20T20:29:36Z","updated_at":"2016-04-20T20:29:36Z","html_url":"https://github.com/fastly/fastly_nsq/pull/25#discussion_r60481512","pull_request_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/comments/60481512"},"html":{"href":"https://github.com/fastly/fastly_nsq/pull/25#discussion_r60481512"},"pull_request":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25","id":66710117,"html_url":"https://github.com/fastly/fastly_nsq/pull/25","diff_url":"https://github.com/fastly/fastly_nsq/pull/25.diff","patch_url":"https://github.com/fastly/fastly_nsq/pull/25.patch","issue_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/25","number":25,"state":"open","locked":false,"title":"Add SSLContext to fastly_nsq","user":{"login":"alieander","id":177143,"avatar_url":"https://avatars.githubusercontent.com/u/177143?v=3","gravatar_id":"","url":"https://api.github.com/users/alieander","html_url":"https://github.com/alieander","followers_url":"https://api.github.com/users/alieander/followers","following_url":"https://api.github.com/users/alieander/following{/other_user}","gists_url":"https://api.github.com/users/alieander/gists{/gist_id}","starred_url":"https://api.github.com/users/alieander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alieander/subscriptions","organizations_url":"https://api.github.com/users/alieander/orgs","repos_url":"https://api.github.com/users/alieander/repos","events_url":"https://api.github.com/users/alieander/events{/privacy}","received_events_url":"https://api.github.com/users/alieander/received_events","type":"User","site_admin":false},"body":"Reason for change\n=================\nWe would like to be able to use TLS/SSL.\nThis allows us to pass a SSLContext thru the producer or consumer to the\nnsq-ruby gem which will then use that information to encrypt communitcations.\nWe would also like for this to be easily setup via ENV variables.\n\nChanges\n=======\n* Add an SSLContext class with tests\n* Use this class in Consumer and Producer\n* Allow consumer and producer to accept a passed in hash ssl_context\n* Forward this SSLContext to the underlying Strategy","created_at":"2016-04-15T21:51:38Z","updated_at":"2016-04-20T20:29:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"960404d5549e6af18a2a913f64862f0a1a61175c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25/commits","review_comments_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25/comments","review_comment_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/25/comments","statuses_url":"https://api.github.com/repos/fastly/fastly_nsq/statuses/4433a5dffb26a1acbc5258597c84286b05d1800d","head":{"label":"fastly:to-ssl-context","ref":"to-ssl-context","sha":"4433a5dffb26a1acbc5258597c84286b05d1800d","user":{"login":"fastly","id":777070,"avatar_url":"https://avatars.githubusercontent.com/u/777070?v=3","gravatar_id":"","url":"https://api.github.com/users/fastly","html_url":"https://github.com/fastly","followers_url":"https://api.github.com/users/fastly/followers","following_url":"https://api.github.com/users/fastly/following{/other_user}","gists_url":"https://api.github.com/users/fastly/gists{/gist_id}","starred_url":"https://api.github.com/users/fastly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastly/subscriptions","organizations_url":"https://api.github.com/users/fastly/orgs","repos_url":"https://api.github.com/users/fastly/repos","events_url":"https://api.github.com/users/fastly/events{/privacy}","received_events_url":"https://api.github.com/users/fastly/received_events","type":"Organization","site_admin":false},"repo":{"id":50699855,"name":"fastly_nsq","full_name":"fastly/fastly_nsq","owner":{"login":"fastly","id":777070,"avatar_url":"https://avatars.githubusercontent.com/u/777070?v=3","gravatar_id":"","url":"https://api.github.com/users/fastly","html_url":"https://github.com/fastly","followers_url":"https://api.github.com/users/fastly/followers","following_url":"https://api.github.com/users/fastly/following{/other_user}","gists_url":"https://api.github.com/users/fastly/gists{/gist_id}","starred_url":"https://api.github.com/users/fastly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastly/subscriptions","organizations_url":"https://api.github.com/users/fastly/orgs","repos_url":"https://api.github.com/users/fastly/repos","events_url":"https://api.github.com/users/fastly/events{/privacy}","received_events_url":"https://api.github.com/users/fastly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fastly/fastly_nsq","description":"Convenience adapter and testing classes for apps talking to NSQ","fork":false,"url":"https://api.github.com/repos/fastly/fastly_nsq","forks_url":"https://api.github.com/repos/fastly/fastly_nsq/forks","keys_url":"https://api.github.com/repos/fastly/fastly_nsq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fastly/fastly_nsq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fastly/fastly_nsq/teams","hooks_url":"https://api.github.com/repos/fastly/fastly_nsq/hooks","issue_events_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/events{/number}","events_url":"https://api.github.com/repos/fastly/fastly_nsq/events","assignees_url":"https://api.github.com/repos/fastly/fastly_nsq/assignees{/user}","branches_url":"https://api.github.com/repos/fastly/fastly_nsq/branches{/branch}","tags_url":"https://api.github.com/repos/fastly/fastly_nsq/tags","blobs_url":"https://api.github.com/repos/fastly/fastly_nsq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fastly/fastly_nsq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fastly/fastly_nsq/git/refs{/sha}","trees_url":"https://api.github.com/repos/fastly/fastly_nsq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fastly/fastly_nsq/statuses/{sha}","languages_url":"https://api.github.com/repos/fastly/fastly_nsq/languages","stargazers_url":"https://api.github.com/repos/fastly/fastly_nsq/stargazers","contributors_url":"https://api.github.com/repos/fastly/fastly_nsq/contributors","subscribers_url":"https://api.github.com/repos/fastly/fastly_nsq/subscribers","subscription_url":"https://api.github.com/repos/fastly/fastly_nsq/subscription","commits_url":"https://api.github.com/repos/fastly/fastly_nsq/commits{/sha}","git_commits_url":"https://api.github.com/repos/fastly/fastly_nsq/git/commits{/sha}","comments_url":"https://api.github.com/repos/fastly/fastly_nsq/comments{/number}","issue_comment_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/comments{/number}","contents_url":"https://api.github.com/repos/fastly/fastly_nsq/contents/{+path}","compare_url":"https://api.github.com/repos/fastly/fastly_nsq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fastly/fastly_nsq/merges","archive_url":"https://api.github.com/repos/fastly/fastly_nsq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fastly/fastly_nsq/downloads","issues_url":"https://api.github.com/repos/fastly/fastly_nsq/issues{/number}","pulls_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls{/number}","milestones_url":"https://api.github.com/repos/fastly/fastly_nsq/milestones{/number}","notifications_url":"https://api.github.com/repos/fastly/fastly_nsq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fastly/fastly_nsq/labels{/name}","releases_url":"https://api.github.com/repos/fastly/fastly_nsq/releases{/id}","deployments_url":"https://api.github.com/repos/fastly/fastly_nsq/deployments","created_at":"2016-01-30T00:07:50Z","updated_at":"2016-03-24T20:41:28Z","pushed_at":"2016-04-20T20:27:45Z","git_url":"git://github.com/fastly/fastly_nsq.git","ssh_url":"git@github.com:fastly/fastly_nsq.git","clone_url":"https://github.com/fastly/fastly_nsq.git","svn_url":"https://github.com/fastly/fastly_nsq","homepage":null,"size":69,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"fastly:master","ref":"master","sha":"7ba9992130344b8686c8c47ce61764c18bc28208","user":{"login":"fastly","id":777070,"avatar_url":"https://avatars.githubusercontent.com/u/777070?v=3","gravatar_id":"","url":"https://api.github.com/users/fastly","html_url":"https://github.com/fastly","followers_url":"https://api.github.com/users/fastly/followers","following_url":"https://api.github.com/users/fastly/following{/other_user}","gists_url":"https://api.github.com/users/fastly/gists{/gist_id}","starred_url":"https://api.github.com/users/fastly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastly/subscriptions","organizations_url":"https://api.github.com/users/fastly/orgs","repos_url":"https://api.github.com/users/fastly/repos","events_url":"https://api.github.com/users/fastly/events{/privacy}","received_events_url":"https://api.github.com/users/fastly/received_events","type":"Organization","site_admin":false},"repo":{"id":50699855,"name":"fastly_nsq","full_name":"fastly/fastly_nsq","owner":{"login":"fastly","id":777070,"avatar_url":"https://avatars.githubusercontent.com/u/777070?v=3","gravatar_id":"","url":"https://api.github.com/users/fastly","html_url":"https://github.com/fastly","followers_url":"https://api.github.com/users/fastly/followers","following_url":"https://api.github.com/users/fastly/following{/other_user}","gists_url":"https://api.github.com/users/fastly/gists{/gist_id}","starred_url":"https://api.github.com/users/fastly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastly/subscriptions","organizations_url":"https://api.github.com/users/fastly/orgs","repos_url":"https://api.github.com/users/fastly/repos","events_url":"https://api.github.com/users/fastly/events{/privacy}","received_events_url":"https://api.github.com/users/fastly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fastly/fastly_nsq","description":"Convenience adapter and testing classes for apps talking to NSQ","fork":false,"url":"https://api.github.com/repos/fastly/fastly_nsq","forks_url":"https://api.github.com/repos/fastly/fastly_nsq/forks","keys_url":"https://api.github.com/repos/fastly/fastly_nsq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fastly/fastly_nsq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fastly/fastly_nsq/teams","hooks_url":"https://api.github.com/repos/fastly/fastly_nsq/hooks","issue_events_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/events{/number}","events_url":"https://api.github.com/repos/fastly/fastly_nsq/events","assignees_url":"https://api.github.com/repos/fastly/fastly_nsq/assignees{/user}","branches_url":"https://api.github.com/repos/fastly/fastly_nsq/branches{/branch}","tags_url":"https://api.github.com/repos/fastly/fastly_nsq/tags","blobs_url":"https://api.github.com/repos/fastly/fastly_nsq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fastly/fastly_nsq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fastly/fastly_nsq/git/refs{/sha}","trees_url":"https://api.github.com/repos/fastly/fastly_nsq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fastly/fastly_nsq/statuses/{sha}","languages_url":"https://api.github.com/repos/fastly/fastly_nsq/languages","stargazers_url":"https://api.github.com/repos/fastly/fastly_nsq/stargazers","contributors_url":"https://api.github.com/repos/fastly/fastly_nsq/contributors","subscribers_url":"https://api.github.com/repos/fastly/fastly_nsq/subscribers","subscription_url":"https://api.github.com/repos/fastly/fastly_nsq/subscription","commits_url":"https://api.github.com/repos/fastly/fastly_nsq/commits{/sha}","git_commits_url":"https://api.github.com/repos/fastly/fastly_nsq/git/commits{/sha}","comments_url":"https://api.github.com/repos/fastly/fastly_nsq/comments{/number}","issue_comment_url":"https://api.github.com/repos/fastly/fastly_nsq/issues/comments{/number}","contents_url":"https://api.github.com/repos/fastly/fastly_nsq/contents/{+path}","compare_url":"https://api.github.com/repos/fastly/fastly_nsq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fastly/fastly_nsq/merges","archive_url":"https://api.github.com/repos/fastly/fastly_nsq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fastly/fastly_nsq/downloads","issues_url":"https://api.github.com/repos/fastly/fastly_nsq/issues{/number}","pulls_url":"https://api.github.com/repos/fastly/fastly_nsq/pulls{/number}","milestones_url":"https://api.github.com/repos/fastly/fastly_nsq/milestones{/number}","notifications_url":"https://api.github.com/repos/fastly/fastly_nsq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fastly/fastly_nsq/labels{/name}","releases_url":"https://api.github.com/repos/fastly/fastly_nsq/releases{/id}","deployments_url":"https://api.github.com/repos/fastly/fastly_nsq/deployments","created_at":"2016-01-30T00:07:50Z","updated_at":"2016-03-24T20:41:28Z","pushed_at":"2016-04-20T20:27:45Z","git_url":"git://github.com/fastly/fastly_nsq.git","ssh_url":"git@github.com:fastly/fastly_nsq.git","clone_url":"https://github.com/fastly/fastly_nsq.git","svn_url":"https://github.com/fastly/fastly_nsq","homepage":null,"size":69,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25"},"html":{"href":"https://github.com/fastly/fastly_nsq/pull/25"},"issue":{"href":"https://api.github.com/repos/fastly/fastly_nsq/issues/25"},"comments":{"href":"https://api.github.com/repos/fastly/fastly_nsq/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fastly/fastly_nsq/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/fastly/fastly_nsq/statuses/4433a5dffb26a1acbc5258597c84286b05d1800d"}}}}