{"action":"created","comment":{"url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/comments/199853939","pull_request_review_id":134055090,"id":199853939,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTg1MzkzOQ==","diff_hunk":"@@ -1,19 +1,57 @@\n-﻿using Microsoft.AspNetCore;\n+﻿using System.Net;\n+using Microsoft.AspNetCore;\n using Microsoft.AspNetCore.Hosting;\n \n-namespace GovUk.Education.ManageCourses.Ui\n-{\n-    public class Program\n-    {\n-        public static void Main(string[] args)\n-        {\n-            BuildWebHost(args).Run();\n+namespace GovUk.Education.ManageCourses.Ui {\n+    public class Program {\n+        public static void Main (string[] args) {\n+            BuildWebHost (args).Run ();\n         }\n \n-        public static IWebHost BuildWebHost(string[] args) =>\n-            WebHost.CreateDefaultBuilder(args)\n-                .UseKestrel(options => options.AddServerHeader = false)\n-                .UseStartup<Startup>()\n-                .Build();\n+        private const int DefaultPort = 44364;\n+        public static int GetPort (string environment) {\n+\n+            var port = DefaultPort;\n+\n+            var envPort = System.Environment.GetEnvironmentVariable ($\"MANAGE_COURSES_API_{environment}_PORT\");\n+            int portNumber;\n+            if (int.TryParse (envPort, out portNumber) &&\n+                portNumber >= 49152 &&\n+                portNumber <= 65535) {\n+                port = portNumber;\n+            }\n+\n+            return port;\n+        }\n+\n+        public static IWebHost BuildWebHost (string[] args) {\n+\n+            return WebHost.CreateDefaultBuilder (args)\n+                .UseKestrel (options => {\n+                    options.AddServerHeader = false;\n+                    var environment = System.Environment.GetEnvironmentVariable (\"ASPNETCORE_ENVIRONMENT\");\n+                    if (environment == \"Development\") {\n+                        var port = GetPort (environment);","path":"src/ui/Program.cs","position":47,"original_position":47,"commit_id":"73969cfb9e3dc8a00b3a0d3cab041157c26895d7","original_commit_id":"73969cfb9e3dc8a00b3a0d3cab041157c26895d7","user":{"login":"defong","id":470137,"node_id":"MDQ6VXNlcjQ3MDEzNw==","avatar_url":"https://avatars2.githubusercontent.com/u/470137?v=4","gravatar_id":"","url":"https://api.github.com/users/defong","html_url":"https://github.com/defong","followers_url":"https://api.github.com/users/defong/followers","following_url":"https://api.github.com/users/defong/following{/other_user}","gists_url":"https://api.github.com/users/defong/gists{/gist_id}","starred_url":"https://api.github.com/users/defong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defong/subscriptions","organizations_url":"https://api.github.com/users/defong/orgs","repos_url":"https://api.github.com/users/defong/repos","events_url":"https://api.github.com/users/defong/events{/privacy}","received_events_url":"https://api.github.com/users/defong/received_events","type":"User","site_admin":false},"body":"@the-daniel-rothig \r\n\r\nI have refactored the code to be more hygienic especially with the ports as not setting or setting invalid values causes random port assignments. \r\n\r\nI have also expand/amended the readme as well","created_at":"2018-07-03T15:36:35Z","updated_at":"2018-07-03T15:36:35Z","html_url":"https://github.com/DFE-Digital/manage-courses-ui/pull/52#discussion_r199853939","pull_request_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/comments/199853939"},"html":{"href":"https://github.com/DFE-Digital/manage-courses-ui/pull/52#discussion_r199853939"},"pull_request":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52","id":198343534,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MzQzNTM0","html_url":"https://github.com/DFE-Digital/manage-courses-ui/pull/52","diff_url":"https://github.com/DFE-Digital/manage-courses-ui/pull/52.diff","patch_url":"https://github.com/DFE-Digital/manage-courses-ui/pull/52.patch","issue_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/52","number":52,"state":"open","locked":false,"title":"make buildable in dotnet","user":{"login":"the-daniel-rothig","id":5263266,"node_id":"MDQ6VXNlcjUyNjMyNjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5263266?v=4","gravatar_id":"","url":"https://api.github.com/users/the-daniel-rothig","html_url":"https://github.com/the-daniel-rothig","followers_url":"https://api.github.com/users/the-daniel-rothig/followers","following_url":"https://api.github.com/users/the-daniel-rothig/following{/other_user}","gists_url":"https://api.github.com/users/the-daniel-rothig/gists{/gist_id}","starred_url":"https://api.github.com/users/the-daniel-rothig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-daniel-rothig/subscriptions","organizations_url":"https://api.github.com/users/the-daniel-rothig/orgs","repos_url":"https://api.github.com/users/the-daniel-rothig/repos","events_url":"https://api.github.com/users/the-daniel-rothig/events{/privacy}","received_events_url":"https://api.github.com/users/the-daniel-rothig/received_events","type":"User","site_admin":false},"body":"Previously you needed msbuild to build + run the UI. No more! This adds the capability to run this with https in kestrel (dotnet core) using a self-signed certificate, and adds a how-to to the readme\r\n\r\nalso includes some structural changes to the read me to split out the Visual Studio only information from general know-how","created_at":"2018-06-29T15:00:53Z","updated_at":"2018-07-03T15:36:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e9f3efc537e3a513f5bab984f8e17a10b839579","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52/commits","review_comments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52/comments","review_comment_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/52/comments","statuses_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/statuses/73969cfb9e3dc8a00b3a0d3cab041157c26895d7","head":{"label":"DFE-Digital:make-buildable","ref":"make-buildable","sha":"73969cfb9e3dc8a00b3a0d3cab041157c26895d7","user":{"login":"DFE-Digital","id":30029772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMDI5Nzcy","avatar_url":"https://avatars3.githubusercontent.com/u/30029772?v=4","gravatar_id":"","url":"https://api.github.com/users/DFE-Digital","html_url":"https://github.com/DFE-Digital","followers_url":"https://api.github.com/users/DFE-Digital/followers","following_url":"https://api.github.com/users/DFE-Digital/following{/other_user}","gists_url":"https://api.github.com/users/DFE-Digital/gists{/gist_id}","starred_url":"https://api.github.com/users/DFE-Digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFE-Digital/subscriptions","organizations_url":"https://api.github.com/users/DFE-Digital/orgs","repos_url":"https://api.github.com/users/DFE-Digital/repos","events_url":"https://api.github.com/users/DFE-Digital/events{/privacy}","received_events_url":"https://api.github.com/users/DFE-Digital/received_events","type":"Organization","site_admin":false},"repo":{"id":133980799,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5ODA3OTk=","name":"manage-courses-ui","full_name":"DFE-Digital/manage-courses-ui","owner":{"login":"DFE-Digital","id":30029772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMDI5Nzcy","avatar_url":"https://avatars3.githubusercontent.com/u/30029772?v=4","gravatar_id":"","url":"https://api.github.com/users/DFE-Digital","html_url":"https://github.com/DFE-Digital","followers_url":"https://api.github.com/users/DFE-Digital/followers","following_url":"https://api.github.com/users/DFE-Digital/following{/other_user}","gists_url":"https://api.github.com/users/DFE-Digital/gists{/gist_id}","starred_url":"https://api.github.com/users/DFE-Digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFE-Digital/subscriptions","organizations_url":"https://api.github.com/users/DFE-Digital/orgs","repos_url":"https://api.github.com/users/DFE-Digital/repos","events_url":"https://api.github.com/users/DFE-Digital/events{/privacy}","received_events_url":"https://api.github.com/users/DFE-Digital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DFE-Digital/manage-courses-ui","description":"Allows course providers to enrich their UCAS course listings before they get published on the new search-and-compare website","fork":false,"url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui","forks_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/forks","keys_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/teams","hooks_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/hooks","issue_events_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/events{/number}","events_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/events","assignees_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/assignees{/user}","branches_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/branches{/branch}","tags_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/tags","blobs_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/languages","stargazers_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/stargazers","contributors_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/contributors","subscribers_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/subscribers","subscription_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/subscription","commits_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/contents/{+path}","compare_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/merges","archive_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/downloads","issues_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues{/number}","pulls_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/labels{/name}","releases_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/releases{/id}","deployments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/deployments","created_at":"2018-05-18T16:48:10Z","updated_at":"2018-07-03T14:49:22Z","pushed_at":"2018-07-03T15:29:58Z","git_url":"git://github.com/DFE-Digital/manage-courses-ui.git","ssh_url":"git@github.com:DFE-Digital/manage-courses-ui.git","clone_url":"https://github.com/DFE-Digital/manage-courses-ui.git","svn_url":"https://github.com/DFE-Digital/manage-courses-ui","homepage":"","size":1591,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"DFE-Digital:master","ref":"master","sha":"c53e62c7d26c3bcc74b7c375141b8e9a50e3d0f6","user":{"login":"DFE-Digital","id":30029772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMDI5Nzcy","avatar_url":"https://avatars3.githubusercontent.com/u/30029772?v=4","gravatar_id":"","url":"https://api.github.com/users/DFE-Digital","html_url":"https://github.com/DFE-Digital","followers_url":"https://api.github.com/users/DFE-Digital/followers","following_url":"https://api.github.com/users/DFE-Digital/following{/other_user}","gists_url":"https://api.github.com/users/DFE-Digital/gists{/gist_id}","starred_url":"https://api.github.com/users/DFE-Digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFE-Digital/subscriptions","organizations_url":"https://api.github.com/users/DFE-Digital/orgs","repos_url":"https://api.github.com/users/DFE-Digital/repos","events_url":"https://api.github.com/users/DFE-Digital/events{/privacy}","received_events_url":"https://api.github.com/users/DFE-Digital/received_events","type":"Organization","site_admin":false},"repo":{"id":133980799,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5ODA3OTk=","name":"manage-courses-ui","full_name":"DFE-Digital/manage-courses-ui","owner":{"login":"DFE-Digital","id":30029772,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMDI5Nzcy","avatar_url":"https://avatars3.githubusercontent.com/u/30029772?v=4","gravatar_id":"","url":"https://api.github.com/users/DFE-Digital","html_url":"https://github.com/DFE-Digital","followers_url":"https://api.github.com/users/DFE-Digital/followers","following_url":"https://api.github.com/users/DFE-Digital/following{/other_user}","gists_url":"https://api.github.com/users/DFE-Digital/gists{/gist_id}","starred_url":"https://api.github.com/users/DFE-Digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFE-Digital/subscriptions","organizations_url":"https://api.github.com/users/DFE-Digital/orgs","repos_url":"https://api.github.com/users/DFE-Digital/repos","events_url":"https://api.github.com/users/DFE-Digital/events{/privacy}","received_events_url":"https://api.github.com/users/DFE-Digital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DFE-Digital/manage-courses-ui","description":"Allows course providers to enrich their UCAS course listings before they get published on the new search-and-compare website","fork":false,"url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui","forks_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/forks","keys_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/teams","hooks_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/hooks","issue_events_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/events{/number}","events_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/events","assignees_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/assignees{/user}","branches_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/branches{/branch}","tags_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/tags","blobs_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/languages","stargazers_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/stargazers","contributors_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/contributors","subscribers_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/subscribers","subscription_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/subscription","commits_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/contents/{+path}","compare_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/merges","archive_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/downloads","issues_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues{/number}","pulls_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/labels{/name}","releases_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/releases{/id}","deployments_url":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/deployments","created_at":"2018-05-18T16:48:10Z","updated_at":"2018-07-03T14:49:22Z","pushed_at":"2018-07-03T15:29:58Z","git_url":"git://github.com/DFE-Digital/manage-courses-ui.git","ssh_url":"git@github.com:DFE-Digital/manage-courses-ui.git","clone_url":"https://github.com/DFE-Digital/manage-courses-ui.git","svn_url":"https://github.com/DFE-Digital/manage-courses-ui","homepage":"","size":1591,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52"},"html":{"href":"https://github.com/DFE-Digital/manage-courses-ui/pull/52"},"issue":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/52"},"comments":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/DFE-Digital/manage-courses-ui/statuses/73969cfb9e3dc8a00b3a0d3cab041157c26895d7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"defong"}}