summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-12-25 23:22:23 -0400
committerDavid Bremner <david@tethera.net>2021-03-19 22:06:44 -0300
commit793d4305d3563082761a59ac418ce827d00bdc39 (patch)
treebd8832fa6617a746ffce46b473543ed9762e6102 /lib
parent6e6c319c260b779e6e91905f8c142ad2b82a41c9 (diff)
lib/open: support NOTMUCH_DATABASE environment variable
The additional code is trivial, but making sure we get the priority of various options correct takes a few tests.
Diffstat (limited to 'lib')
-rw-r--r--lib/open.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/open.cc b/lib/open.cc
index d05a19a7..6e46168a 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -168,6 +168,10 @@ _choose_database_path (void *ctx,
return status;
}
+ if (! *database_path) {
+ *database_path = getenv ("NOTMUCH_DATABASE");
+ }
+
if (! *database_path && *key_file) {
char *path = g_key_file_get_value (*key_file, "database", "path", NULL);
if (path) {