{"action":"created","comment":{"url":"https://api.github.com/repos/Mashape/kong/pulls/comments/52617510","id":52617510,"diff_hunk":"@@ -144,9 +144,11 @@ function Kong.init()\n end\n \n function Kong.init_worker()\n+  prepare_module_variables()","path":"kong/kong.lua","position":75,"original_position":75,"commit_id":"bed865a4b78799c55d14c4a70c12285961a8e440","original_commit_id":"bed865a4b78799c55d14c4a70c12285961a8e440","user":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"body":"You're right that the upvalues follow into `init_worker`. This was left over from an experiment to generate a new set of the values in `init_worker`, which reveals the [`API disabled in the context of init_worker_by_lua*`](https://github.com/Mashape/kong/issues/966) errors.\r\n\r\nRemoving this now, avoiding any functional change with this PR.","created_at":"2016-02-11T15:37:09Z","updated_at":"2016-02-11T15:37:09Z","html_url":"https://github.com/Mashape/kong/pull/982#discussion_r52617510","pull_request_url":"https://api.github.com/repos/Mashape/kong/pulls/982","_links":{"self":{"href":"https://api.github.com/repos/Mashape/kong/pulls/comments/52617510"},"html":{"href":"https://github.com/Mashape/kong/pull/982#discussion_r52617510"},"pull_request":{"href":"https://api.github.com/repos/Mashape/kong/pulls/982"}}},"pull_request":{"url":"https://api.github.com/repos/Mashape/kong/pulls/982","id":58976571,"html_url":"https://github.com/Mashape/kong/pull/982","diff_url":"https://github.com/Mashape/kong/pull/982.diff","patch_url":"https://github.com/Mashape/kong/pull/982.patch","issue_url":"https://api.github.com/repos/Mashape/kong/issues/982","number":982,"state":"open","locked":false,"title":"Replace globals with `kong.singletons` module variables.","user":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"body":"*(Second try on this PR.)*\r\n\r\nFollow-through from https://github.com/mars/kong/commit/f59c849960930dd2e709197df10d14ef93bfd06c\r\n\r\nReplacing globals will not change any functional behavior. It will:\r\n\r\n* avoid slow global lookups\r\n* make it easier for devs to see where values come from\r\n\r\nThe module name `singletons` was chosen to make it easy to find these anywhere in the project; names like `env`, `environment`, `config`, etc. would lead to confusion.\r\n","created_at":"2016-02-11T00:21:40Z","updated_at":"2016-02-11T15:37:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5618c08a2e76bf4e26695a45cdd4f8b3a01259f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Mashape/kong/pulls/982/commits","review_comments_url":"https://api.github.com/repos/Mashape/kong/pulls/982/comments","review_comment_url":"https://api.github.com/repos/Mashape/kong/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Mashape/kong/issues/982/comments","statuses_url":"https://api.github.com/repos/Mashape/kong/statuses/bed865a4b78799c55d14c4a70c12285961a8e440","head":{"label":"mars:feature/convert-globals-to-module-vars","ref":"feature/convert-globals-to-module-vars","sha":"bed865a4b78799c55d14c4a70c12285961a8e440","user":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"repo":{"id":50950454,"name":"kong","full_name":"mars/kong","owner":{"login":"mars","id":17164,"avatar_url":"https://avatars.githubusercontent.com/u/17164?v=3","gravatar_id":"","url":"https://api.github.com/users/mars","html_url":"https://github.com/mars","followers_url":"https://api.github.com/users/mars/followers","following_url":"https://api.github.com/users/mars/following{/other_user}","gists_url":"https://api.github.com/users/mars/gists{/gist_id}","starred_url":"https://api.github.com/users/mars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars/subscriptions","organizations_url":"https://api.github.com/users/mars/orgs","repos_url":"https://api.github.com/users/mars/repos","events_url":"https://api.github.com/users/mars/events{/privacy}","received_events_url":"https://api.github.com/users/mars/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mars/kong","description":":monkey: Open-source, Microservice & API Management Layer built on top of NGINX","fork":true,"url":"https://api.github.com/repos/mars/kong","forks_url":"https://api.github.com/repos/mars/kong/forks","keys_url":"https://api.github.com/repos/mars/kong/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mars/kong/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mars/kong/teams","hooks_url":"https://api.github.com/repos/mars/kong/hooks","issue_events_url":"https://api.github.com/repos/mars/kong/issues/events{/number}","events_url":"https://api.github.com/repos/mars/kong/events","assignees_url":"https://api.github.com/repos/mars/kong/assignees{/user}","branches_url":"https://api.github.com/repos/mars/kong/branches{/branch}","tags_url":"https://api.github.com/repos/mars/kong/tags","blobs_url":"https://api.github.com/repos/mars/kong/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mars/kong/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mars/kong/git/refs{/sha}","trees_url":"https://api.github.com/repos/mars/kong/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mars/kong/statuses/{sha}","languages_url":"https://api.github.com/repos/mars/kong/languages","stargazers_url":"https://api.github.com/repos/mars/kong/stargazers","contributors_url":"https://api.github.com/repos/mars/kong/contributors","subscribers_url":"https://api.github.com/repos/mars/kong/subscribers","subscription_url":"https://api.github.com/repos/mars/kong/subscription","commits_url":"https://api.github.com/repos/mars/kong/commits{/sha}","git_commits_url":"https://api.github.com/repos/mars/kong/git/commits{/sha}","comments_url":"https://api.github.com/repos/mars/kong/comments{/number}","issue_comment_url":"https://api.github.com/repos/mars/kong/issues/comments{/number}","contents_url":"https://api.github.com/repos/mars/kong/contents/{+path}","compare_url":"https://api.github.com/repos/mars/kong/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mars/kong/merges","archive_url":"https://api.github.com/repos/mars/kong/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mars/kong/downloads","issues_url":"https://api.github.com/repos/mars/kong/issues{/number}","pulls_url":"https://api.github.com/repos/mars/kong/pulls{/number}","milestones_url":"https://api.github.com/repos/mars/kong/milestones{/number}","notifications_url":"https://api.github.com/repos/mars/kong/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mars/kong/labels{/name}","releases_url":"https://api.github.com/repos/mars/kong/releases{/id}","deployments_url":"https://api.github.com/repos/mars/kong/deployments","created_at":"2016-02-02T20:42:31Z","updated_at":"2016-02-02T20:42:33Z","pushed_at":"2016-02-11T00:57:57Z","git_url":"git://github.com/mars/kong.git","ssh_url":"git@github.com:mars/kong.git","clone_url":"https://github.com/mars/kong.git","svn_url":"https://github.com/mars/kong","homepage":"https://getkong.org","size":3033,"stargazers_count":0,"watchers_count":0,"language":"Lua","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":"Mashape:master","ref":"master","sha":"6f398bd0cc65be1fa7d53ed88bca271735b705d7","user":{"login":"Mashape","id":962416,"avatar_url":"https://avatars.githubusercontent.com/u/962416?v=3","gravatar_id":"","url":"https://api.github.com/users/Mashape","html_url":"https://github.com/Mashape","followers_url":"https://api.github.com/users/Mashape/followers","following_url":"https://api.github.com/users/Mashape/following{/other_user}","gists_url":"https://api.github.com/users/Mashape/gists{/gist_id}","starred_url":"https://api.github.com/users/Mashape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mashape/subscriptions","organizations_url":"https://api.github.com/users/Mashape/orgs","repos_url":"https://api.github.com/users/Mashape/repos","events_url":"https://api.github.com/users/Mashape/events{/privacy}","received_events_url":"https://api.github.com/users/Mashape/received_events","type":"Organization","site_admin":false},"repo":{"id":26783295,"name":"kong","full_name":"Mashape/kong","owner":{"login":"Mashape","id":962416,"avatar_url":"https://avatars.githubusercontent.com/u/962416?v=3","gravatar_id":"","url":"https://api.github.com/users/Mashape","html_url":"https://github.com/Mashape","followers_url":"https://api.github.com/users/Mashape/followers","following_url":"https://api.github.com/users/Mashape/following{/other_user}","gists_url":"https://api.github.com/users/Mashape/gists{/gist_id}","starred_url":"https://api.github.com/users/Mashape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mashape/subscriptions","organizations_url":"https://api.github.com/users/Mashape/orgs","repos_url":"https://api.github.com/users/Mashape/repos","events_url":"https://api.github.com/users/Mashape/events{/privacy}","received_events_url":"https://api.github.com/users/Mashape/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Mashape/kong","description":":monkey: Open-source, Microservice & API Management Layer built on top of NGINX","fork":false,"url":"https://api.github.com/repos/Mashape/kong","forks_url":"https://api.github.com/repos/Mashape/kong/forks","keys_url":"https://api.github.com/repos/Mashape/kong/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mashape/kong/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mashape/kong/teams","hooks_url":"https://api.github.com/repos/Mashape/kong/hooks","issue_events_url":"https://api.github.com/repos/Mashape/kong/issues/events{/number}","events_url":"https://api.github.com/repos/Mashape/kong/events","assignees_url":"https://api.github.com/repos/Mashape/kong/assignees{/user}","branches_url":"https://api.github.com/repos/Mashape/kong/branches{/branch}","tags_url":"https://api.github.com/repos/Mashape/kong/tags","blobs_url":"https://api.github.com/repos/Mashape/kong/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mashape/kong/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mashape/kong/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mashape/kong/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mashape/kong/statuses/{sha}","languages_url":"https://api.github.com/repos/Mashape/kong/languages","stargazers_url":"https://api.github.com/repos/Mashape/kong/stargazers","contributors_url":"https://api.github.com/repos/Mashape/kong/contributors","subscribers_url":"https://api.github.com/repos/Mashape/kong/subscribers","subscription_url":"https://api.github.com/repos/Mashape/kong/subscription","commits_url":"https://api.github.com/repos/Mashape/kong/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mashape/kong/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mashape/kong/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mashape/kong/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mashape/kong/contents/{+path}","compare_url":"https://api.github.com/repos/Mashape/kong/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mashape/kong/merges","archive_url":"https://api.github.com/repos/Mashape/kong/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mashape/kong/downloads","issues_url":"https://api.github.com/repos/Mashape/kong/issues{/number}","pulls_url":"https://api.github.com/repos/Mashape/kong/pulls{/number}","milestones_url":"https://api.github.com/repos/Mashape/kong/milestones{/number}","notifications_url":"https://api.github.com/repos/Mashape/kong/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mashape/kong/labels{/name}","releases_url":"https://api.github.com/repos/Mashape/kong/releases{/id}","deployments_url":"https://api.github.com/repos/Mashape/kong/deployments","created_at":"2014-11-17T23:56:08Z","updated_at":"2016-02-11T09:53:08Z","pushed_at":"2016-02-11T02:31:22Z","git_url":"git://github.com/Mashape/kong.git","ssh_url":"git@github.com:Mashape/kong.git","clone_url":"https://github.com/Mashape/kong.git","svn_url":"https://github.com/Mashape/kong","homepage":"https://getkong.org","size":106767,"stargazers_count":4138,"watchers_count":4138,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":276,"mirror_url":null,"open_issues_count":180,"forks":276,"open_issues":180,"watchers":4138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Mashape/kong/pulls/982"},"html":{"href":"https://github.com/Mashape/kong/pull/982"},"issue":{"href":"https://api.github.com/repos/Mashape/kong/issues/982"},"comments":{"href":"https://api.github.com/repos/Mashape/kong/issues/982/comments"},"review_comments":{"href":"https://api.github.com/repos/Mashape/kong/pulls/982/comments"},"review_comment":{"href":"https://api.github.com/repos/Mashape/kong/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Mashape/kong/pulls/982/commits"},"statuses":{"href":"https://api.github.com/repos/Mashape/kong/statuses/bed865a4b78799c55d14c4a70c12285961a8e440"}}}}