aboutsummaryrefslogtreecommitdiff
path: root/scripts/p7s/mbsync.py
blob: 8c4194e3792f3b569d53703b36eb6206f32b35fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pathlib
import textwrap

from p7s import bitwarden


def generate_config():
    gmail_password = bitwarden.get_item("https://bitwarden.pdp7.net", "alex@corcoles.net", "cad137b0-cfd5-4d5c-b167-98a9e792f4cc")["login"]["password"]
    (pathlib.Path.home() / (".mbsyncrc")).write_text(textwrap.dedent(f"""
        IMAPStore gmail-remote
        Host imap.gmail.com
        SSLType IMAPS
        AuthMechs LOGIN
        User koalillo@gmail.com
        Pass "{gmail_password}"

        MaildirStore gmail-local
        Path ~/Mail/koalillo@gmail.com/
        Inbox ~/Mail/koalillo@gmail.com/INBOX
        Subfolders Verbatim

        Channel gmail
        Far :gmail-remote:
        Near :gmail-local:
        Create Both
        Expunge Both
        Patterns *
        SyncState *
    """))