Skip to content

Commit a2e749c

Browse files
marcusmuellerlanguitar
authored andcommitted
Provide a host variable for targets
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
1 parent b93f19c commit a2e749c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ As a consequence, in case you want to use the same account for all github projec
6969
[github.com*]
7070
target=dev/github
7171
```
72+
The host can be used as a variable to address a pass entry.
73+
This is especially helpful for wildcard matches:
74+
```ini
75+
[*]
76+
target=git-logins/${host}
77+
```
78+
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.
7279

7380
## Passwordstore Layout
7481

pass-git-helper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def get_password(request, mapping):
109109
LOGGER.debug('Section "%s" matches requested host "%s"',
110110
section, host)
111111
# TODO handle exceptions
112-
pass_target = mapping.get(section, 'target')
112+
pass_target = mapping.get(section, 'target').replace("${host}", host)
113113
skip_password_chars = mapping.getint(
114114
section, 'skip_password', fallback=0)
115115
skip_username_chars = mapping.getint(

0 commit comments

Comments
 (0)