{"action":"created","comment":{"url":"https://api.github.com/repos/kelseyhightower/confd/pulls/comments/173750317","pull_request_review_id":102978882,"id":173750317,"diff_hunk":"@@ -0,0 +1,116 @@\n+package template\n+\n+import (\n+\t\"fmt\"\n+\t\"github.com/kelseyhightower/confd/log\"\n+\t\"os\"\n+\t\"path\"\n+\t\"path/filepath\"\n+)\n+\n+// fileInfo describes a configuration file and is returned by fileStat.\n+type FileInfo struct {\n+\tUid  uint32\n+\tGid  uint32\n+\tMode os.FileMode\n+\tMd5  string\n+}\n+\n+func AppendPrefix(prefix string, keys []string) []string {\n+\ts := make([]string, len(keys))\n+\tfor i, k := range keys {\n+\t\ts[i] = path.Join(prefix, k)\n+\t}\n+\treturn s\n+}\n+\n+// isFileExist reports whether path exits.\n+func IsFileExist(fpath string) bool {\n+\tif _, err := os.Stat(fpath); os.IsNotExist(err) {\n+\t\treturn false\n+\t}\n+\treturn true\n+}\n+\n+// IsConfigChanged reports whether src and dest config files are equal.\n+// Two config files are equal when they have the same file contents and\n+// Unix permissions. The owner, group, and mode must match.\n+// It return false in other cases.\n+func IsConfigChanged(src, dest string) (bool, error) {\n+\tif !IsFileExist(dest) {\n+\t\treturn true, nil\n+\t}\n+\td, err := filestat(dest)\n+\tif err != nil {\n+\t\treturn true, err\n+\t}\n+\ts, err := filestat(src)\n+\tif err != nil {\n+\t\treturn true, err\n+\t}\n+\tif d.Uid != s.Uid {\n+\t\tlog.Info(fmt.Sprintf(\"%s has UID %d should be %d\", dest, d.Uid, s.Uid))\n+\t}\n+\tif d.Gid != s.Gid {\n+\t\tlog.Info(fmt.Sprintf(\"%s has GID %d should be %d\", dest, d.Gid, s.Gid))\n+\t}\n+\tif d.Mode != s.Mode {\n+\t\tlog.Info(fmt.Sprintf(\"%s has mode %s should be %s\", dest, os.FileMode(d.Mode), os.FileMode(s.Mode)))\n+\t}\n+\tif d.Md5 != s.Md5 {\n+\t\tlog.Info(fmt.Sprintf(\"%s has md5sum %s should be %s\", dest, d.Md5, s.Md5))\n+\t}\n+\tif d.Uid != s.Uid || d.Gid != s.Gid || d.Mode != s.Mode || d.Md5 != s.Md5 {\n+\t\treturn true, nil\n+\t}\n+\treturn false, nil\n+}\n+\n+func IsDirectory(path string) (bool, error) {\n+\tf, err := os.Stat(path)\n+\tif err != nil {\n+\t\treturn false, err\n+\t}\n+\tswitch mode := f.Mode(); {\n+\tcase mode.IsDir():\n+\t\treturn true, nil\n+\tcase mode.IsRegular():\n+\t\treturn false, nil\n+\t}\n+\treturn false, nil\n+}\n+\n+func Lookup(root string, pattern string) ([]string, []string, error) {","path":"util/util.go","position":83,"original_position":83,"commit_id":"2611c46562cdd8ee9a6174c5645b7670bd030fc5","original_commit_id":"2611c46562cdd8ee9a6174c5645b7670bd030fc5","user":{"login":"okushchenko","id":8613413,"avatar_url":"https://avatars3.githubusercontent.com/u/8613413?v=4","gravatar_id":"","url":"https://api.github.com/users/okushchenko","html_url":"https://github.com/okushchenko","followers_url":"https://api.github.com/users/okushchenko/followers","following_url":"https://api.github.com/users/okushchenko/following{/other_user}","gists_url":"https://api.github.com/users/okushchenko/gists{/gist_id}","starred_url":"https://api.github.com/users/okushchenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okushchenko/subscriptions","organizations_url":"https://api.github.com/users/okushchenko/orgs","repos_url":"https://api.github.com/users/okushchenko/repos","events_url":"https://api.github.com/users/okushchenko/events{/privacy}","received_events_url":"https://api.github.com/users/okushchenko/received_events","type":"User","site_admin":false},"body":"`Lookup` is very ambiguous. Rename it to `recursiveFindFiles` or something more appropriate.","created_at":"2018-03-12T10:31:42Z","updated_at":"2018-03-12T10:39:18Z","html_url":"https://github.com/kelseyhightower/confd/pull/686#discussion_r173750317","pull_request_url":"https://api.github.com/repos/kelseyhightower/confd/pulls/686","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/comments/173750317"},"html":{"href":"https://github.com/kelseyhightower/confd/pull/686#discussion_r173750317"},"pull_request":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/686"}}},"pull_request":{"url":"https://api.github.com/repos/kelseyhightower/confd/pulls/686","id":173642039,"html_url":"https://github.com/kelseyhightower/confd/pull/686","diff_url":"https://github.com/kelseyhightower/confd/pull/686.diff","patch_url":"https://github.com/kelseyhightower/confd/pull/686.patch","issue_url":"https://api.github.com/repos/kelseyhightower/confd/issues/686","number":686,"state":"open","locked":false,"title":"File yaml backend fix","user":{"login":"AndrewChubatiuk","id":3162380,"avatar_url":"https://avatars3.githubusercontent.com/u/3162380?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewChubatiuk","html_url":"https://github.com/AndrewChubatiuk","followers_url":"https://api.github.com/users/AndrewChubatiuk/followers","following_url":"https://api.github.com/users/AndrewChubatiuk/following{/other_user}","gists_url":"https://api.github.com/users/AndrewChubatiuk/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewChubatiuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewChubatiuk/subscriptions","organizations_url":"https://api.github.com/users/AndrewChubatiuk/orgs","repos_url":"https://api.github.com/users/AndrewChubatiuk/repos","events_url":"https://api.github.com/users/AndrewChubatiuk/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewChubatiuk/received_events","type":"User","site_admin":false},"body":"* Fixes #667. Fixes #640 Fixes #588\r\n* Added support for multiple yaml files and directories\r\n* Added -filter flag for files/directories filtering\r\n* Added configs reload on SIGHUP\r\n* Added recursive file watcher","created_at":"2018-03-08T04:20:26Z","updated_at":"2018-03-12T10:39:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e17ed4707e1651f759c280cbcbf35be87486de7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kelseyhightower/confd/pulls/686/commits","review_comments_url":"https://api.github.com/repos/kelseyhightower/confd/pulls/686/comments","review_comment_url":"https://api.github.com/repos/kelseyhightower/confd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kelseyhightower/confd/issues/686/comments","statuses_url":"https://api.github.com/repos/kelseyhightower/confd/statuses/2611c46562cdd8ee9a6174c5645b7670bd030fc5","head":{"label":"AndrewChubatiuk:file-yaml-backend-fix","ref":"file-yaml-backend-fix","sha":"2611c46562cdd8ee9a6174c5645b7670bd030fc5","user":{"login":"AndrewChubatiuk","id":3162380,"avatar_url":"https://avatars3.githubusercontent.com/u/3162380?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewChubatiuk","html_url":"https://github.com/AndrewChubatiuk","followers_url":"https://api.github.com/users/AndrewChubatiuk/followers","following_url":"https://api.github.com/users/AndrewChubatiuk/following{/other_user}","gists_url":"https://api.github.com/users/AndrewChubatiuk/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewChubatiuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewChubatiuk/subscriptions","organizations_url":"https://api.github.com/users/AndrewChubatiuk/orgs","repos_url":"https://api.github.com/users/AndrewChubatiuk/repos","events_url":"https://api.github.com/users/AndrewChubatiuk/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewChubatiuk/received_events","type":"User","site_admin":false},"repo":{"id":123726876,"name":"confd","full_name":"AndrewChubatiuk/confd","owner":{"login":"AndrewChubatiuk","id":3162380,"avatar_url":"https://avatars3.githubusercontent.com/u/3162380?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewChubatiuk","html_url":"https://github.com/AndrewChubatiuk","followers_url":"https://api.github.com/users/AndrewChubatiuk/followers","following_url":"https://api.github.com/users/AndrewChubatiuk/following{/other_user}","gists_url":"https://api.github.com/users/AndrewChubatiuk/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewChubatiuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewChubatiuk/subscriptions","organizations_url":"https://api.github.com/users/AndrewChubatiuk/orgs","repos_url":"https://api.github.com/users/AndrewChubatiuk/repos","events_url":"https://api.github.com/users/AndrewChubatiuk/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewChubatiuk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AndrewChubatiuk/confd","description":"Manage local application configuration files using templates and data from etcd or consul","fork":true,"url":"https://api.github.com/repos/AndrewChubatiuk/confd","forks_url":"https://api.github.com/repos/AndrewChubatiuk/confd/forks","keys_url":"https://api.github.com/repos/AndrewChubatiuk/confd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndrewChubatiuk/confd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndrewChubatiuk/confd/teams","hooks_url":"https://api.github.com/repos/AndrewChubatiuk/confd/hooks","issue_events_url":"https://api.github.com/repos/AndrewChubatiuk/confd/issues/events{/number}","events_url":"https://api.github.com/repos/AndrewChubatiuk/confd/events","assignees_url":"https://api.github.com/repos/AndrewChubatiuk/confd/assignees{/user}","branches_url":"https://api.github.com/repos/AndrewChubatiuk/confd/branches{/branch}","tags_url":"https://api.github.com/repos/AndrewChubatiuk/confd/tags","blobs_url":"https://api.github.com/repos/AndrewChubatiuk/confd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndrewChubatiuk/confd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndrewChubatiuk/confd/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndrewChubatiuk/confd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndrewChubatiuk/confd/statuses/{sha}","languages_url":"https://api.github.com/repos/AndrewChubatiuk/confd/languages","stargazers_url":"https://api.github.com/repos/AndrewChubatiuk/confd/stargazers","contributors_url":"https://api.github.com/repos/AndrewChubatiuk/confd/contributors","subscribers_url":"https://api.github.com/repos/AndrewChubatiuk/confd/subscribers","subscription_url":"https://api.github.com/repos/AndrewChubatiuk/confd/subscription","commits_url":"https://api.github.com/repos/AndrewChubatiuk/confd/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndrewChubatiuk/confd/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndrewChubatiuk/confd/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndrewChubatiuk/confd/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndrewChubatiuk/confd/contents/{+path}","compare_url":"https://api.github.com/repos/AndrewChubatiuk/confd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndrewChubatiuk/confd/merges","archive_url":"https://api.github.com/repos/AndrewChubatiuk/confd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndrewChubatiuk/confd/downloads","issues_url":"https://api.github.com/repos/AndrewChubatiuk/confd/issues{/number}","pulls_url":"https://api.github.com/repos/AndrewChubatiuk/confd/pulls{/number}","milestones_url":"https://api.github.com/repos/AndrewChubatiuk/confd/milestones{/number}","notifications_url":"https://api.github.com/repos/AndrewChubatiuk/confd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndrewChubatiuk/confd/labels{/name}","releases_url":"https://api.github.com/repos/AndrewChubatiuk/confd/releases{/id}","deployments_url":"https://api.github.com/repos/AndrewChubatiuk/confd/deployments","created_at":"2018-03-03T20:02:41Z","updated_at":"2018-03-03T20:02:43Z","pushed_at":"2018-03-12T09:59:17Z","git_url":"git://github.com/AndrewChubatiuk/confd.git","ssh_url":"git@github.com:AndrewChubatiuk/confd.git","clone_url":"https://github.com/AndrewChubatiuk/confd.git","svn_url":"https://github.com/AndrewChubatiuk/confd","homepage":"","size":11222,"stargazers_count":0,"watchers_count":0,"language":"Go","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":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kelseyhightower:master","ref":"master","sha":"560171742e6b822972e9699cac296beacadaf607","user":{"login":"kelseyhightower","id":1123322,"avatar_url":"https://avatars2.githubusercontent.com/u/1123322?v=4","gravatar_id":"","url":"https://api.github.com/users/kelseyhightower","html_url":"https://github.com/kelseyhightower","followers_url":"https://api.github.com/users/kelseyhightower/followers","following_url":"https://api.github.com/users/kelseyhightower/following{/other_user}","gists_url":"https://api.github.com/users/kelseyhightower/gists{/gist_id}","starred_url":"https://api.github.com/users/kelseyhightower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelseyhightower/subscriptions","organizations_url":"https://api.github.com/users/kelseyhightower/orgs","repos_url":"https://api.github.com/users/kelseyhightower/repos","events_url":"https://api.github.com/users/kelseyhightower/events{/privacy}","received_events_url":"https://api.github.com/users/kelseyhightower/received_events","type":"User","site_admin":false},"repo":{"id":13234395,"name":"confd","full_name":"kelseyhightower/confd","owner":{"login":"kelseyhightower","id":1123322,"avatar_url":"https://avatars2.githubusercontent.com/u/1123322?v=4","gravatar_id":"","url":"https://api.github.com/users/kelseyhightower","html_url":"https://github.com/kelseyhightower","followers_url":"https://api.github.com/users/kelseyhightower/followers","following_url":"https://api.github.com/users/kelseyhightower/following{/other_user}","gists_url":"https://api.github.com/users/kelseyhightower/gists{/gist_id}","starred_url":"https://api.github.com/users/kelseyhightower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelseyhightower/subscriptions","organizations_url":"https://api.github.com/users/kelseyhightower/orgs","repos_url":"https://api.github.com/users/kelseyhightower/repos","events_url":"https://api.github.com/users/kelseyhightower/events{/privacy}","received_events_url":"https://api.github.com/users/kelseyhightower/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kelseyhightower/confd","description":"Manage local application configuration files using templates and data from etcd or consul","fork":false,"url":"https://api.github.com/repos/kelseyhightower/confd","forks_url":"https://api.github.com/repos/kelseyhightower/confd/forks","keys_url":"https://api.github.com/repos/kelseyhightower/confd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kelseyhightower/confd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kelseyhightower/confd/teams","hooks_url":"https://api.github.com/repos/kelseyhightower/confd/hooks","issue_events_url":"https://api.github.com/repos/kelseyhightower/confd/issues/events{/number}","events_url":"https://api.github.com/repos/kelseyhightower/confd/events","assignees_url":"https://api.github.com/repos/kelseyhightower/confd/assignees{/user}","branches_url":"https://api.github.com/repos/kelseyhightower/confd/branches{/branch}","tags_url":"https://api.github.com/repos/kelseyhightower/confd/tags","blobs_url":"https://api.github.com/repos/kelseyhightower/confd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kelseyhightower/confd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kelseyhightower/confd/git/refs{/sha}","trees_url":"https://api.github.com/repos/kelseyhightower/confd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kelseyhightower/confd/statuses/{sha}","languages_url":"https://api.github.com/repos/kelseyhightower/confd/languages","stargazers_url":"https://api.github.com/repos/kelseyhightower/confd/stargazers","contributors_url":"https://api.github.com/repos/kelseyhightower/confd/contributors","subscribers_url":"https://api.github.com/repos/kelseyhightower/confd/subscribers","subscription_url":"https://api.github.com/repos/kelseyhightower/confd/subscription","commits_url":"https://api.github.com/repos/kelseyhightower/confd/commits{/sha}","git_commits_url":"https://api.github.com/repos/kelseyhightower/confd/git/commits{/sha}","comments_url":"https://api.github.com/repos/kelseyhightower/confd/comments{/number}","issue_comment_url":"https://api.github.com/repos/kelseyhightower/confd/issues/comments{/number}","contents_url":"https://api.github.com/repos/kelseyhightower/confd/contents/{+path}","compare_url":"https://api.github.com/repos/kelseyhightower/confd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kelseyhightower/confd/merges","archive_url":"https://api.github.com/repos/kelseyhightower/confd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kelseyhightower/confd/downloads","issues_url":"https://api.github.com/repos/kelseyhightower/confd/issues{/number}","pulls_url":"https://api.github.com/repos/kelseyhightower/confd/pulls{/number}","milestones_url":"https://api.github.com/repos/kelseyhightower/confd/milestones{/number}","notifications_url":"https://api.github.com/repos/kelseyhightower/confd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kelseyhightower/confd/labels{/name}","releases_url":"https://api.github.com/repos/kelseyhightower/confd/releases{/id}","deployments_url":"https://api.github.com/repos/kelseyhightower/confd/deployments","created_at":"2013-10-01T04:06:09Z","updated_at":"2018-03-12T09:24:53Z","pushed_at":"2018-03-12T09:59:20Z","git_url":"git://github.com/kelseyhightower/confd.git","ssh_url":"git@github.com:kelseyhightower/confd.git","clone_url":"https://github.com/kelseyhightower/confd.git","svn_url":"https://github.com/kelseyhightower/confd","homepage":"","size":11176,"stargazers_count":4782,"watchers_count":4782,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":806,"mirror_url":null,"archived":false,"open_issues_count":82,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":806,"open_issues":82,"watchers":4782,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/686"},"html":{"href":"https://github.com/kelseyhightower/confd/pull/686"},"issue":{"href":"https://api.github.com/repos/kelseyhightower/confd/issues/686"},"comments":{"href":"https://api.github.com/repos/kelseyhightower/confd/issues/686/comments"},"review_comments":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/686/comments"},"review_comment":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kelseyhightower/confd/pulls/686/commits"},"statuses":{"href":"https://api.github.com/repos/kelseyhightower/confd/statuses/2611c46562cdd8ee9a6174c5645b7670bd030fc5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"okushchenko"}}