Skip to content

Commit

Permalink
Provide a host variable for targets
Browse files Browse the repository at this point in the history
Now, you can use `${host}` in your `target=`, enabling wildcard matches
in the ini, so that one ini entry can match mutliple hosts with
different passwords successfully.

fixes #7
  • Loading branch information
marcusmueller authored and languitar committed Sep 5, 2017
1 parent b93f19c commit a2e749c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -69,6 +69,13 @@ As a consequence, in case you want to use the same account for all github projec
[github.com*]
target=dev/github
```
The host can be used as a variable to address a pass entry.
This is especially helpful for wildcard matches:
```ini
[*]
target=git-logins/${host}
```
The above configuration directive will lead to any host that did not match any previous section in the ini file to being looked up under the `git-logins` directory in your passwordstore.

## Passwordstore Layout

Expand Down
2 changes: 1 addition & 1 deletion pass-git-helper
Expand Up @@ -109,7 +109,7 @@ def get_password(request, mapping):
LOGGER.debug('Section "%s" matches requested host "%s"',
section, host)
# TODO handle exceptions
pass_target = mapping.get(section, 'target')
pass_target = mapping.get(section, 'target').replace("${host}", host)
skip_password_chars = mapping.getint(
section, 'skip_password', fallback=0)
skip_username_chars = mapping.getint(
Expand Down

0 comments on commit a2e749c

Please sign in to comment.