{"action":"closed","number":8084,"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/8084","id":157455714,"html_url":"https://github.com/playframework/playframework/pull/8084","diff_url":"https://github.com/playframework/playframework/pull/8084.diff","patch_url":"https://github.com/playframework/playframework/pull/8084.patch","issue_url":"https://api.github.com/repos/playframework/playframework/issues/8084","number":8084,"state":"closed","locked":false,"title":"Add ConfigLoader macro","user":{"login":"gmethvin","id":171663,"avatar_url":"https://avatars1.githubusercontent.com/u/171663?v=4","gravatar_id":"","url":"https://api.github.com/users/gmethvin","html_url":"https://github.com/gmethvin","followers_url":"https://api.github.com/users/gmethvin/followers","following_url":"https://api.github.com/users/gmethvin/following{/other_user}","gists_url":"https://api.github.com/users/gmethvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gmethvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmethvin/subscriptions","organizations_url":"https://api.github.com/users/gmethvin/orgs","repos_url":"https://api.github.com/users/gmethvin/repos","events_url":"https://api.github.com/users/gmethvin/events{/privacy}","received_events_url":"https://api.github.com/users/gmethvin/received_events","type":"User","site_admin":false},"body":"This adds a macro `ConfigLoader.forClass[T]`  that attempts to generate a configuration loader based on a class.\r\n\r\nFor example, if you have\r\n\r\n```scala\r\ncase class SecurityHeadersConfig(\r\n    frameOptions: Option[String],\r\n    xssProtection: Option[String],\r\n    contentTypeOptions: Option[String],\r\n    permittedCrossDomainPolicies: Option[String],\r\n    contentSecurityPolicy: Option[String],\r\n    referrerPolicy: Option[String],\r\n    allowActionSpecificHeaders: Boolean = false\r\n)\r\nobject SecurityHeadersConfig {\r\n  implicit val configLoader: ConfigLoader[SecurityHeadersConfig] = ConfigLoader.forClass\r\n}\r\n```\r\n\r\nthe macro allows you to use `configuration.get[SecurityHeadersConfig](path)` to read an object like:\r\n\r\n```\r\n{\r\n    frameOptions = \"DENY\"\r\n    xssProtection = \"1; mode=block\"\r\n    contentTypeOptions = \"nosniff\"\r\n    permittedCrossDomainPolicies = \"master-only\"\r\n    contentSecurityPolicy = null\r\n    referrerPolicy = \"origin-when-cross-origin, strict-origin-when-cross-origin\"\r\n    allowActionSpecificHeaders = false\r\n}\r\n```\r\n\r\nI was actually hoping I could use the macro in more places, but we'd need to separate the macro into a separate library to use it for `HttpConfiguration` and many of the config classes we use in Play. Also we have some custom logic in our config loading to deal with deprecation and other unusual cases. Mainly this is interesting for end users, since it makes it much simpler to design your app to deal with configuration in a type-safe way.","created_at":"2017-12-10T23:17:04Z","updated_at":"2018-05-30T08:42:27Z","closed_at":"2018-05-30T08:42:27Z","merged_at":null,"merge_commit_sha":"799b1f1db8f165a26a7c47b00fa9c6755dfd509b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/playframework/playframework/pulls/8084/commits","review_comments_url":"https://api.github.com/repos/playframework/playframework/pulls/8084/comments","review_comment_url":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/8084/comments","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/7f410385c32b7557d80c5695b36e6373d232eea2","head":{"label":"gmethvin:config-macro","ref":"config-macro","sha":"7f410385c32b7557d80c5695b36e6373d232eea2","user":{"login":"gmethvin","id":171663,"avatar_url":"https://avatars1.githubusercontent.com/u/171663?v=4","gravatar_id":"","url":"https://api.github.com/users/gmethvin","html_url":"https://github.com/gmethvin","followers_url":"https://api.github.com/users/gmethvin/followers","following_url":"https://api.github.com/users/gmethvin/following{/other_user}","gists_url":"https://api.github.com/users/gmethvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gmethvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmethvin/subscriptions","organizations_url":"https://api.github.com/users/gmethvin/orgs","repos_url":"https://api.github.com/users/gmethvin/repos","events_url":"https://api.github.com/users/gmethvin/events{/privacy}","received_events_url":"https://api.github.com/users/gmethvin/received_events","type":"User","site_admin":false},"repo":{"id":10559361,"name":"playframework","full_name":"gmethvin/playframework","owner":{"login":"gmethvin","id":171663,"avatar_url":"https://avatars1.githubusercontent.com/u/171663?v=4","gravatar_id":"","url":"https://api.github.com/users/gmethvin","html_url":"https://github.com/gmethvin","followers_url":"https://api.github.com/users/gmethvin/followers","following_url":"https://api.github.com/users/gmethvin/following{/other_user}","gists_url":"https://api.github.com/users/gmethvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gmethvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmethvin/subscriptions","organizations_url":"https://api.github.com/users/gmethvin/orgs","repos_url":"https://api.github.com/users/gmethvin/repos","events_url":"https://api.github.com/users/gmethvin/events{/privacy}","received_events_url":"https://api.github.com/users/gmethvin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gmethvin/playframework","description":"Play framework 2.x","fork":true,"url":"https://api.github.com/repos/gmethvin/playframework","forks_url":"https://api.github.com/repos/gmethvin/playframework/forks","keys_url":"https://api.github.com/repos/gmethvin/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gmethvin/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gmethvin/playframework/teams","hooks_url":"https://api.github.com/repos/gmethvin/playframework/hooks","issue_events_url":"https://api.github.com/repos/gmethvin/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/gmethvin/playframework/events","assignees_url":"https://api.github.com/repos/gmethvin/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/gmethvin/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/gmethvin/playframework/tags","blobs_url":"https://api.github.com/repos/gmethvin/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gmethvin/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gmethvin/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/gmethvin/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gmethvin/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/gmethvin/playframework/languages","stargazers_url":"https://api.github.com/repos/gmethvin/playframework/stargazers","contributors_url":"https://api.github.com/repos/gmethvin/playframework/contributors","subscribers_url":"https://api.github.com/repos/gmethvin/playframework/subscribers","subscription_url":"https://api.github.com/repos/gmethvin/playframework/subscription","commits_url":"https://api.github.com/repos/gmethvin/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/gmethvin/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/gmethvin/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/gmethvin/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/gmethvin/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/gmethvin/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gmethvin/playframework/merges","archive_url":"https://api.github.com/repos/gmethvin/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gmethvin/playframework/downloads","issues_url":"https://api.github.com/repos/gmethvin/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/gmethvin/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/gmethvin/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/gmethvin/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gmethvin/playframework/labels{/name}","releases_url":"https://api.github.com/repos/gmethvin/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/gmethvin/playframework/deployments","created_at":"2013-06-07T21:37:27Z","updated_at":"2014-07-24T15:49:25Z","pushed_at":"2018-05-27T18:30:45Z","git_url":"git://github.com/gmethvin/playframework.git","ssh_url":"git@github.com:gmethvin/playframework.git","clone_url":"https://github.com/gmethvin/playframework.git","svn_url":"https://github.com/gmethvin/playframework","homepage":"http://www.playframework.org/","size":88638,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"playframework:master","ref":"master","sha":"568a0e47d621702b75dc6afd9c800427ae22d673","user":{"login":"playframework","id":319107,"avatar_url":"https://avatars0.githubusercontent.com/u/319107?v=4","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"repo":{"id":2340549,"name":"playframework","full_name":"playframework/playframework","owner":{"login":"playframework","id":319107,"avatar_url":"https://avatars0.githubusercontent.com/u/319107?v=4","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/playframework/playframework","description":"Play Framework","fork":false,"url":"https://api.github.com/repos/playframework/playframework","forks_url":"https://api.github.com/repos/playframework/playframework/forks","keys_url":"https://api.github.com/repos/playframework/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/playframework/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/playframework/playframework/teams","hooks_url":"https://api.github.com/repos/playframework/playframework/hooks","issue_events_url":"https://api.github.com/repos/playframework/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/playframework/playframework/events","assignees_url":"https://api.github.com/repos/playframework/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/playframework/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/playframework/playframework/tags","blobs_url":"https://api.github.com/repos/playframework/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/playframework/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/playframework/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/playframework/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/playframework/playframework/languages","stargazers_url":"https://api.github.com/repos/playframework/playframework/stargazers","contributors_url":"https://api.github.com/repos/playframework/playframework/contributors","subscribers_url":"https://api.github.com/repos/playframework/playframework/subscribers","subscription_url":"https://api.github.com/repos/playframework/playframework/subscription","commits_url":"https://api.github.com/repos/playframework/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/playframework/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/playframework/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/playframework/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/playframework/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/playframework/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/playframework/playframework/merges","archive_url":"https://api.github.com/repos/playframework/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/playframework/playframework/downloads","issues_url":"https://api.github.com/repos/playframework/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/playframework/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/playframework/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/playframework/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/playframework/playframework/labels{/name}","releases_url":"https://api.github.com/repos/playframework/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/playframework/playframework/deployments","created_at":"2011-09-07T09:24:08Z","updated_at":"2018-05-30T08:36:57Z","pushed_at":"2018-05-30T08:36:43Z","git_url":"git://github.com/playframework/playframework.git","ssh_url":"git@github.com:playframework/playframework.git","clone_url":"https://github.com/playframework/playframework.git","svn_url":"https://github.com/playframework/playframework","homepage":"http://www.playframework.com/","size":89728,"stargazers_count":10465,"watchers_count":10465,"language":"Scala","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3547,"mirror_url":null,"archived":false,"open_issues_count":376,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":3547,"open_issues":376,"watchers":10465,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8084"},"html":{"href":"https://github.com/playframework/playframework/pull/8084"},"issue":{"href":"https://api.github.com/repos/playframework/playframework/issues/8084"},"comments":{"href":"https://api.github.com/repos/playframework/playframework/issues/8084/comments"},"review_comments":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8084/comments"},"review_comment":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8084/commits"},"statuses":{"href":"https://api.github.com/repos/playframework/playframework/statuses/7f410385c32b7557d80c5695b36e6373d232eea2"}},"author_association":"MEMBER","merged":false,"mergeable":false,"rebaseable":false,"mergeable_state":"dirty","merged_by":null,"comments":3,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":160,"deletions":13,"changed_files":5}}
{"actor":{"display_login":"gmethvin"}}