Skip to content

Commit

Permalink
vdirsyncer: fallback to root-level username and password
Browse files Browse the repository at this point in the history
  • Loading branch information
dezeroku committed May 2, 2024
1 parent f5677b4 commit 7f769e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ local_machine:
# address_books:
# - Contacts
# url: https://some-mailbox-url/carddav
# username_cmd: secret-tool lookup mail/example_mailbox username
# password_cmd: secret-tool lookup mail/example_mailbox password
# # username_cmd: secret-tool lookup mail/example_mailbox username
# # password_cmd: secret-tool lookup mail/example_mailbox password
# caldav:
# calendars:
# - Calendar
# - Birthdays
# url: https://some-mailbox-url/caldav/
# username_cmd: secret-tool lookup mail/example_mailbox username
# password_cmd: secret-tool lookup mail/example_mailbox password
# # username_cmd: secret-tool lookup mail/example_mailbox username
# # password_cmd: secret-tool lookup mail/example_mailbox password
# todoman:
# default_list: mailbox-Tasks
16 changes: 16 additions & 0 deletions roles/vdirsyncer/templates/config
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ fileext = ".vcf"
type = "carddav"

url = "{{ item.carddav.url }}"
{% if 'username_cmd' in item.carddav %}
username.fetch = ["command", {{ item.carddav.username_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% else %}
username.fetch = ["command", {{ item.username_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% endif %}
{% if 'password_cmd' in item.carddav %}
password.fetch = ["command", {{ item.carddav.password_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% else %}
password.fetch = ["command", {{ item.password_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% endif %}
{% else %}
type = "google_contacts"

token_file.fetch = ["command", "~/.config/vdirsyncer/oauth-mailctl.sh", "{{ item.from.email }}"]
Expand Down Expand Up @@ -49,9 +57,17 @@ fileext = ".ics"
type = "caldav"

url = "{{ item.caldav.url }}"
{% if 'username_cmd' in item.caldav %}
username.fetch = ["command", {{ item.caldav.username_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% else %}
username.fetch = ["command", {{ item.username_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% endif %}
{% if 'password_cmd' in item.caldav %}
password.fetch = ["command", {{ item.caldav.password_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% else %}
password.fetch = ["command", {{ item.password_cmd.split() | map('join') | map("to_json") | join(", ") }}]
{% endif %}
{% else %}
type = "google_calendar"

token_file.fetch = ["command", "~/.config/vdirsyncer/oauth-mailctl.sh", "{{ item.from.email }}"]
Expand Down

0 comments on commit 7f769e0

Please sign in to comment.