{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/comments/69922941","id":69922941,"diff_hunk":"@@ -0,0 +1,107 @@\n+package mongodb\n+\n+import (\n+\t\"fmt\"\n+\t\"time\"\n+\n+\t\"github.com/hashicorp/vault/logical\"\n+\t\"github.com/hashicorp/vault/logical/framework\"\n+)\n+\n+func pathConfigLease(b *backend) *framework.Path {\n+\treturn &framework.Path{\n+\t\tPattern: \"config/lease\",\n+\t\tFields: map[string]*framework.FieldSchema{\n+\t\t\t\"ttl\": &framework.FieldSchema{\n+\t\t\t\tType:        framework.TypeString,\n+\t\t\t\tDescription: \"Default ttl for credentials.\",\n+\t\t\t},\n+\n+\t\t\t\"max_ttl\": &framework.FieldSchema{\n+\t\t\t\tType:        framework.TypeString,\n+\t\t\t\tDescription: \"Maximum time a set of credentials can be valid for.\",\n+\t\t\t},\n+\t\t},\n+\n+\t\tCallbacks: map[logical.Operation]framework.OperationFunc{\n+\t\t\tlogical.ReadOperation:   b.pathConfigLeaseRead,\n+\t\t\tlogical.UpdateOperation: b.pathConfigLeaseWrite,\n+\t\t},\n+\n+\t\tHelpSynopsis:    pathConfigLeaseHelpSyn,\n+\t\tHelpDescription: pathConfigLeaseHelpDesc,\n+\t}\n+}\n+\n+func (b *backend) pathConfigLeaseWrite(\n+\treq *logical.Request, d *framework.FieldData) (*logical.Response, error) {\n+\tttlRaw := d.Get(\"ttl\").(string)\n+\tmaxTTLRaw := d.Get(\"max_ttl\").(string)\n+\n+\tttl, err := time.ParseDuration(ttlRaw)\n+\tif err != nil {\n+\t\treturn logical.ErrorResponse(fmt.Sprintf(\n+\t\t\t\"Invalid ttl: %s\", err)), nil\n+\t}\n+\tmaxTTL, err := time.ParseDuration(maxTTLRaw)\n+\tif err != nil {\n+\t\treturn logical.ErrorResponse(fmt.Sprintf(\n+\t\t\t\"Invalid max_ttl: %s\", err)), nil\n+\t}\n+\n+\t// Store it\n+\tentry, err := logical.StorageEntryJSON(\"config/lease\", &configLease{","path":"builtin/logical/mongodb/path_config_lease.go","position":53,"original_position":53,"commit_id":"2b5b56febd568a74a201216eab76ebdc9e636d21","original_commit_id":"2b5b56febd568a74a201216eab76ebdc9e636d21","user":{"login":"jefferai","id":28627,"avatar_url":"https://avatars.githubusercontent.com/u/28627?v=3","gravatar_id":"","url":"https://api.github.com/users/jefferai","html_url":"https://github.com/jefferai","followers_url":"https://api.github.com/users/jefferai/followers","following_url":"https://api.github.com/users/jefferai/following{/other_user}","gists_url":"https://api.github.com/users/jefferai/gists{/gist_id}","starred_url":"https://api.github.com/users/jefferai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jefferai/subscriptions","organizations_url":"https://api.github.com/users/jefferai/orgs","repos_url":"https://api.github.com/users/jefferai/repos","events_url":"https://api.github.com/users/jefferai/events{/privacy}","received_events_url":"https://api.github.com/users/jefferai/received_events","type":"User","site_admin":false},"body":"See above comment. After changing it this entire section above can basically be removed and you can just set the TTL/MaxTTL values below with `d.Get(\"ttl\"/\"max_ttl\").(int)`. They'll return 0 if not set.","created_at":"2016-07-07T15:00:56Z","updated_at":"2016-07-07T15:00:56Z","html_url":"https://github.com/hashicorp/vault/pull/1414#discussion_r69922941","pull_request_url":"https://api.github.com/repos/hashicorp/vault/pulls/1414","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments/69922941"},"html":{"href":"https://github.com/hashicorp/vault/pull/1414#discussion_r69922941"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1414"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/vault/pulls/1414","id":70055817,"html_url":"https://github.com/hashicorp/vault/pull/1414","diff_url":"https://github.com/hashicorp/vault/pull/1414.diff","patch_url":"https://github.com/hashicorp/vault/pull/1414.patch","issue_url":"https://api.github.com/repos/hashicorp/vault/issues/1414","number":1414,"state":"open","locked":false,"title":"Add mongodb secret backend","user":{"login":"mhurne","id":677354,"avatar_url":"https://avatars.githubusercontent.com/u/677354?v=3","gravatar_id":"","url":"https://api.github.com/users/mhurne","html_url":"https://github.com/mhurne","followers_url":"https://api.github.com/users/mhurne/followers","following_url":"https://api.github.com/users/mhurne/following{/other_user}","gists_url":"https://api.github.com/users/mhurne/gists{/gist_id}","starred_url":"https://api.github.com/users/mhurne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhurne/subscriptions","organizations_url":"https://api.github.com/users/mhurne/orgs","repos_url":"https://api.github.com/users/mhurne/repos","events_url":"https://api.github.com/users/mhurne/events{/privacy}","received_events_url":"https://api.github.com/users/mhurne/received_events","type":"User","site_admin":false},"body":"Add mongodb secret backend, per #362.","created_at":"2016-05-13T20:46:35Z","updated_at":"2016-07-07T15:00:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"053a24796769ba704de789eb8ed1acd09568d413","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/hashicorp/vault/milestones/10","html_url":"https://github.com/hashicorp/vault/milestones/0.6.1","labels_url":"https://api.github.com/repos/hashicorp/vault/milestones/10/labels","id":1760654,"number":10,"title":"0.6.1","description":null,"creator":{"login":"jefferai","id":28627,"avatar_url":"https://avatars.githubusercontent.com/u/28627?v=3","gravatar_id":"","url":"https://api.github.com/users/jefferai","html_url":"https://github.com/jefferai","followers_url":"https://api.github.com/users/jefferai/followers","following_url":"https://api.github.com/users/jefferai/following{/other_user}","gists_url":"https://api.github.com/users/jefferai/gists{/gist_id}","starred_url":"https://api.github.com/users/jefferai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jefferai/subscriptions","organizations_url":"https://api.github.com/users/jefferai/orgs","repos_url":"https://api.github.com/users/jefferai/repos","events_url":"https://api.github.com/users/jefferai/events{/privacy}","received_events_url":"https://api.github.com/users/jefferai/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":24,"state":"open","created_at":"2016-05-11T17:49:55Z","updated_at":"2016-07-07T14:48:17Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hashicorp/vault/pulls/1414/commits","review_comments_url":"https://api.github.com/repos/hashicorp/vault/pulls/1414/comments","review_comment_url":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/vault/issues/1414/comments","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/2b5b56febd568a74a201216eab76ebdc9e636d21","head":{"label":"mhurne:mongodb-secret-backend","ref":"mongodb-secret-backend","sha":"2b5b56febd568a74a201216eab76ebdc9e636d21","user":{"login":"mhurne","id":677354,"avatar_url":"https://avatars.githubusercontent.com/u/677354?v=3","gravatar_id":"","url":"https://api.github.com/users/mhurne","html_url":"https://github.com/mhurne","followers_url":"https://api.github.com/users/mhurne/followers","following_url":"https://api.github.com/users/mhurne/following{/other_user}","gists_url":"https://api.github.com/users/mhurne/gists{/gist_id}","starred_url":"https://api.github.com/users/mhurne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhurne/subscriptions","organizations_url":"https://api.github.com/users/mhurne/orgs","repos_url":"https://api.github.com/users/mhurne/repos","events_url":"https://api.github.com/users/mhurne/events{/privacy}","received_events_url":"https://api.github.com/users/mhurne/received_events","type":"User","site_admin":false},"repo":{"id":38401220,"name":"vault","full_name":"mhurne/vault","owner":{"login":"mhurne","id":677354,"avatar_url":"https://avatars.githubusercontent.com/u/677354?v=3","gravatar_id":"","url":"https://api.github.com/users/mhurne","html_url":"https://github.com/mhurne","followers_url":"https://api.github.com/users/mhurne/followers","following_url":"https://api.github.com/users/mhurne/following{/other_user}","gists_url":"https://api.github.com/users/mhurne/gists{/gist_id}","starred_url":"https://api.github.com/users/mhurne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhurne/subscriptions","organizations_url":"https://api.github.com/users/mhurne/orgs","repos_url":"https://api.github.com/users/mhurne/repos","events_url":"https://api.github.com/users/mhurne/events{/privacy}","received_events_url":"https://api.github.com/users/mhurne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mhurne/vault","description":"A tool for managing secrets.","fork":true,"url":"https://api.github.com/repos/mhurne/vault","forks_url":"https://api.github.com/repos/mhurne/vault/forks","keys_url":"https://api.github.com/repos/mhurne/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mhurne/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mhurne/vault/teams","hooks_url":"https://api.github.com/repos/mhurne/vault/hooks","issue_events_url":"https://api.github.com/repos/mhurne/vault/issues/events{/number}","events_url":"https://api.github.com/repos/mhurne/vault/events","assignees_url":"https://api.github.com/repos/mhurne/vault/assignees{/user}","branches_url":"https://api.github.com/repos/mhurne/vault/branches{/branch}","tags_url":"https://api.github.com/repos/mhurne/vault/tags","blobs_url":"https://api.github.com/repos/mhurne/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mhurne/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mhurne/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/mhurne/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mhurne/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/mhurne/vault/languages","stargazers_url":"https://api.github.com/repos/mhurne/vault/stargazers","contributors_url":"https://api.github.com/repos/mhurne/vault/contributors","subscribers_url":"https://api.github.com/repos/mhurne/vault/subscribers","subscription_url":"https://api.github.com/repos/mhurne/vault/subscription","commits_url":"https://api.github.com/repos/mhurne/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/mhurne/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/mhurne/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/mhurne/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/mhurne/vault/contents/{+path}","compare_url":"https://api.github.com/repos/mhurne/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mhurne/vault/merges","archive_url":"https://api.github.com/repos/mhurne/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mhurne/vault/downloads","issues_url":"https://api.github.com/repos/mhurne/vault/issues{/number}","pulls_url":"https://api.github.com/repos/mhurne/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/mhurne/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/mhurne/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mhurne/vault/labels{/name}","releases_url":"https://api.github.com/repos/mhurne/vault/releases{/id}","deployments_url":"https://api.github.com/repos/mhurne/vault/deployments","created_at":"2015-07-01T23:57:44Z","updated_at":"2016-07-02T00:36:23Z","pushed_at":"2016-07-05T14:03:07Z","git_url":"git://github.com/mhurne/vault.git","ssh_url":"git@github.com:mhurne/vault.git","clone_url":"https://github.com/mhurne/vault.git","svn_url":"https://github.com/mhurne/vault","homepage":"http://vaultproject.io","size":16006,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"829563372d2a3d8f92baf426ce7313202f0aea9c","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":31288958,"name":"vault","full_name":"hashicorp/vault","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/vault","description":"A tool for managing secrets.","fork":false,"url":"https://api.github.com/repos/hashicorp/vault","forks_url":"https://api.github.com/repos/hashicorp/vault/forks","keys_url":"https://api.github.com/repos/hashicorp/vault/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/vault/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/vault/teams","hooks_url":"https://api.github.com/repos/hashicorp/vault/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/vault/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/vault/events","assignees_url":"https://api.github.com/repos/hashicorp/vault/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/vault/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/vault/tags","blobs_url":"https://api.github.com/repos/hashicorp/vault/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/vault/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/vault/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/vault/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/vault/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/vault/languages","stargazers_url":"https://api.github.com/repos/hashicorp/vault/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/vault/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/vault/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/vault/subscription","commits_url":"https://api.github.com/repos/hashicorp/vault/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/vault/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/vault/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/vault/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/vault/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/vault/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/vault/merges","archive_url":"https://api.github.com/repos/hashicorp/vault/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/vault/downloads","issues_url":"https://api.github.com/repos/hashicorp/vault/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/vault/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/vault/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/vault/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/vault/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/vault/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/vault/deployments","created_at":"2015-02-25T00:15:59Z","updated_at":"2016-07-07T14:59:38Z","pushed_at":"2016-07-07T14:52:01Z","git_url":"git://github.com/hashicorp/vault.git","ssh_url":"git@github.com:hashicorp/vault.git","clone_url":"https://github.com/hashicorp/vault.git","svn_url":"https://github.com/hashicorp/vault","homepage":"https://www.vaultproject.io/","size":17841,"stargazers_count":4913,"watchers_count":4913,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":485,"mirror_url":null,"open_issues_count":167,"forks":485,"open_issues":167,"watchers":4913,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1414"},"html":{"href":"https://github.com/hashicorp/vault/pull/1414"},"issue":{"href":"https://api.github.com/repos/hashicorp/vault/issues/1414"},"comments":{"href":"https://api.github.com/repos/hashicorp/vault/issues/1414/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1414/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/vault/pulls/1414/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/vault/statuses/2b5b56febd568a74a201216eab76ebdc9e636d21"}}}}
{"actor":{"display_login":"jefferai"}}