{"action":"created","comment":{"url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/comments/175317524","pull_request_review_id":104825358,"id":175317524,"diff_hunk":"@@ -0,0 +1,88 @@\n+import * as dotenv from \"dotenv\";\n+import * as fs from \"fs\";\n+import * as path from \"path\";\n+import {promisify} from \"util\";\n+import {removeNulls} from \"../../shared/utils/arrays\";\n+\n+const readFile = promisify(fs.readFile);\n+\n+let currentEnvironment: Array<{ [index: string]: string }>;\n+\n+/**\n+ *\n+ * @returns {Promise<{[p: string]: string}[]>}\n+ */\n+export const registerEnvironmentConfiguration = async () => {\n+\n+    if (!currentEnvironment) {\n+\n+        const applicationName = \"example1\";\n+        const deploymentEnvironment = \"production\";\n+\n+        const envPath = path.join(`src`, `apps`, applicationName, `config`, `env`);\n+        // Get the possible environments\n+        const envFileResolutionOrder = [\n+            `.env.secrets`,\n+            `.env`,\n+            `.env.${deploymentEnvironment}.secrets`,\n+            `.env.${deploymentEnvironment}`\n+        ].map((p) => path.resolve(envPath, p));\n+\n+        // Create promises for each of these file reads\n+        const envPromises = envFileResolutionOrder.map((filePath: string) =>\n+            readFile(filePath)\n+                .then((file) => dotenv.parse(file))\n+                .catch(() => null));\n+\n+        // Resolve them all\n+        const resolvedEnvs = await Promise.all(removeNulls(envPromises));\n+\n+        // Return a flattened object\n+        currentEnvironment = resolvedEnvs.reduceRight((acc, o) => Object.assign({}, acc, o), {});\n+    }\n+\n+    return currentEnvironment;\n+};\n+\n+/**\n+ *\n+ * @param {string} name\n+ * @param {string} defaultValue\n+ * @returns {Promise<string>}\n+ */\n+const string = (name: string, defaultValue?: string): string => {","path":"src/core/server/utils/environment.ts","position":53,"original_position":53,"commit_id":"f31c030fa661062da0ebe259a0dc4d21d23e2bbb","original_commit_id":"f31c030fa661062da0ebe259a0dc4d21d23e2bbb","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [variable name clashes with keyword/type](https://app.codacy.com/app/bryan_7/redt-monorepo-proposal/pullRequest?prid=1445629)","created_at":"2018-03-19T02:07:47Z","updated_at":"2018-03-19T02:07:47Z","html_url":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14#discussion_r175317524","pull_request_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/comments/175317524"},"html":{"href":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14#discussion_r175317524"},"pull_request":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14","id":175789202,"html_url":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14","diff_url":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14.diff","patch_url":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14.patch","issue_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/14","number":14,"state":"open","locked":false,"title":"Add configuration support","user":{"login":"bryanmig","id":43345,"avatar_url":"https://avatars2.githubusercontent.com/u/43345?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanmig","html_url":"https://github.com/bryanmig","followers_url":"https://api.github.com/users/bryanmig/followers","following_url":"https://api.github.com/users/bryanmig/following{/other_user}","gists_url":"https://api.github.com/users/bryanmig/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmig/subscriptions","organizations_url":"https://api.github.com/users/bryanmig/orgs","repos_url":"https://api.github.com/users/bryanmig/repos","events_url":"https://api.github.com/users/bryanmig/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmig/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-19T02:02:19Z","updated_at":"2018-03-19T02:07:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21efa28e6a83b98be1ddd1d6a1649cda1aef81a0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14/commits","review_comments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14/comments","review_comment_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/14/comments","statuses_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/statuses/f31c030fa661062da0ebe259a0dc4d21d23e2bbb","head":{"label":"bryanmig:configuration","ref":"configuration","sha":"f31c030fa661062da0ebe259a0dc4d21d23e2bbb","user":{"login":"bryanmig","id":43345,"avatar_url":"https://avatars2.githubusercontent.com/u/43345?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanmig","html_url":"https://github.com/bryanmig","followers_url":"https://api.github.com/users/bryanmig/followers","following_url":"https://api.github.com/users/bryanmig/following{/other_user}","gists_url":"https://api.github.com/users/bryanmig/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmig/subscriptions","organizations_url":"https://api.github.com/users/bryanmig/orgs","repos_url":"https://api.github.com/users/bryanmig/repos","events_url":"https://api.github.com/users/bryanmig/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmig/received_events","type":"User","site_admin":false},"repo":{"id":124778185,"name":"redt-monorepo-proposal","full_name":"bryanmig/redt-monorepo-proposal","owner":{"login":"bryanmig","id":43345,"avatar_url":"https://avatars2.githubusercontent.com/u/43345?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanmig","html_url":"https://github.com/bryanmig","followers_url":"https://api.github.com/users/bryanmig/followers","following_url":"https://api.github.com/users/bryanmig/following{/other_user}","gists_url":"https://api.github.com/users/bryanmig/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmig/subscriptions","organizations_url":"https://api.github.com/users/bryanmig/orgs","repos_url":"https://api.github.com/users/bryanmig/repos","events_url":"https://api.github.com/users/bryanmig/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bryanmig/redt-monorepo-proposal","description":null,"fork":false,"url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal","forks_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/forks","keys_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/teams","hooks_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/hooks","issue_events_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/events{/number}","events_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/events","assignees_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/assignees{/user}","branches_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/branches{/branch}","tags_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/tags","blobs_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/refs{/sha}","trees_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/statuses/{sha}","languages_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/languages","stargazers_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/stargazers","contributors_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/contributors","subscribers_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/subscribers","subscription_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/subscription","commits_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/commits{/sha}","git_commits_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/commits{/sha}","comments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/comments{/number}","issue_comment_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/comments{/number}","contents_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/contents/{+path}","compare_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/merges","archive_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/downloads","issues_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues{/number}","pulls_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls{/number}","milestones_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/milestones{/number}","notifications_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/labels{/name}","releases_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/releases{/id}","deployments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/deployments","created_at":"2018-03-11T16:54:29Z","updated_at":"2018-03-17T16:29:52Z","pushed_at":"2018-03-19T02:06:23Z","git_url":"git://github.com/bryanmig/redt-monorepo-proposal.git","ssh_url":"git@github.com:bryanmig/redt-monorepo-proposal.git","clone_url":"https://github.com/bryanmig/redt-monorepo-proposal.git","svn_url":"https://github.com/bryanmig/redt-monorepo-proposal","homepage":null,"size":690,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"bryanmig:master","ref":"master","sha":"f788c436145392dbcfcee8e7440bbbaaf1d63424","user":{"login":"bryanmig","id":43345,"avatar_url":"https://avatars2.githubusercontent.com/u/43345?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanmig","html_url":"https://github.com/bryanmig","followers_url":"https://api.github.com/users/bryanmig/followers","following_url":"https://api.github.com/users/bryanmig/following{/other_user}","gists_url":"https://api.github.com/users/bryanmig/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmig/subscriptions","organizations_url":"https://api.github.com/users/bryanmig/orgs","repos_url":"https://api.github.com/users/bryanmig/repos","events_url":"https://api.github.com/users/bryanmig/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmig/received_events","type":"User","site_admin":false},"repo":{"id":124778185,"name":"redt-monorepo-proposal","full_name":"bryanmig/redt-monorepo-proposal","owner":{"login":"bryanmig","id":43345,"avatar_url":"https://avatars2.githubusercontent.com/u/43345?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanmig","html_url":"https://github.com/bryanmig","followers_url":"https://api.github.com/users/bryanmig/followers","following_url":"https://api.github.com/users/bryanmig/following{/other_user}","gists_url":"https://api.github.com/users/bryanmig/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmig/subscriptions","organizations_url":"https://api.github.com/users/bryanmig/orgs","repos_url":"https://api.github.com/users/bryanmig/repos","events_url":"https://api.github.com/users/bryanmig/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bryanmig/redt-monorepo-proposal","description":null,"fork":false,"url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal","forks_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/forks","keys_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/teams","hooks_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/hooks","issue_events_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/events{/number}","events_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/events","assignees_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/assignees{/user}","branches_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/branches{/branch}","tags_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/tags","blobs_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/refs{/sha}","trees_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/statuses/{sha}","languages_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/languages","stargazers_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/stargazers","contributors_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/contributors","subscribers_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/subscribers","subscription_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/subscription","commits_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/commits{/sha}","git_commits_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/git/commits{/sha}","comments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/comments{/number}","issue_comment_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/comments{/number}","contents_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/contents/{+path}","compare_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/merges","archive_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/downloads","issues_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues{/number}","pulls_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls{/number}","milestones_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/milestones{/number}","notifications_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/labels{/name}","releases_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/releases{/id}","deployments_url":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/deployments","created_at":"2018-03-11T16:54:29Z","updated_at":"2018-03-17T16:29:52Z","pushed_at":"2018-03-19T02:06:23Z","git_url":"git://github.com/bryanmig/redt-monorepo-proposal.git","ssh_url":"git@github.com:bryanmig/redt-monorepo-proposal.git","clone_url":"https://github.com/bryanmig/redt-monorepo-proposal.git","svn_url":"https://github.com/bryanmig/redt-monorepo-proposal","homepage":null,"size":690,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14"},"html":{"href":"https://github.com/bryanmig/redt-monorepo-proposal/pull/14"},"issue":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/14"},"comments":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/bryanmig/redt-monorepo-proposal/statuses/f31c030fa661062da0ebe259a0dc4d21d23e2bbb"}},"author_association":"OWNER"}}
{"actor":{"display_login":"codacy-bot"}}