dotfiles

Author: Kyle Fuller <kyle@fuller.li> 2020-08-25 18:48:52 +0100 +0100
Committer: Kyle Fuller <kyle@fuller.li> 2020-08-25 18:50:42 +0100 +0100
Commit: 92a247df4eee7e2f3b73e48884bf8f03b155d042
Parent: b68daa4a40b04089cc9f9d3d0c2314b4f2180e54


feat: add base offlineimap config
diff --git a/.config/offlineimap/config b/.config/offlineimap/config
new file mode 100644
index 0000000000000000000000000000000000000000..c6910961f5a5bab88bd047b22ac63bce318218bb
--- /dev/null
+++ b/.config/offlineimap/config
@@ -0,0 +1,21 @@
+[general]
+accounts = kyle
+fsync = false
+pythonfile = ~/.config/offlineimap/config.py
+
+[Account kyle]
+remoterepository = kyle-remote
+localrepository = kyle-local
+postsynchook = notmuch new
+
+[Repository kyle-remote]
+type = IMAP
+remotehost = imap.fastmail.com
+remoteuser = kyle@fuller.li
+remotepasseval = get_op_item('Fastmail', 'app_password')
+ssl = yes
+sslcacertfile = /etc/ssl/certs/ca-certificates.crt
+
+[Repository kyle-local]
+type = Maildir
+localfolders = ~/Mail/kyle@fuller.li
diff --git a/.config/offlineimap/config.py b/.config/offlineimap/config.py
new file mode 100755
index 0000000000000000000000000000000000000000..414b6c424143bdb6a3d0baf6a746bc2762737fe1
--- /dev/null
+++ b/.config/offlineimap/config.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import sys
+import subprocess
+
+
+def get_op_item(item, field):
+    return subprocess.check_output(
+        ['op', 'get', 'item', item, '--fields', field]
+    ).decode('utf-8')
+
+
+def get_op_username(item):
+    return get_op_item(item, 'username')
+
+
+def get_op_password(item):
+    return get_op_item(item, 'password')