diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-12 13:45:10 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-12 13:45:10 +1100 |
commit | 1b9c3da26adee88aa2f9ee41a681410de9e32cdf (patch) | |
tree | 51e7ceece47154d1979f46d8350e2f6946352407 /src/conn | |
parent | 9d023ab3ded81b9a2210fdb5ebc4b089f387e622 (diff) | |
download | mongo-1b9c3da26adee88aa2f9ee41a681410de9e32cdf.tar.gz |
WT-2212 Add a "use_environment" config to "wiredtiger_open"
Diffstat (limited to 'src/conn')
-rw-r--r-- | src/conn/conn_api.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index c65b74e4e4e..bd14e1bf4fd 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -1286,6 +1286,11 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf) const char *env_config; size_t len; + /* Only use the environment variable if configured. */ + WT_RET(__wt_config_gets(session, cfg, "use_environment", &cval)); + if (cval.val == 0) + return (0); + ret = __wt_getenv(session, "WIREDTIGER_CONFIG", &env_config); if (ret == WT_NOTFOUND) return (0); @@ -1333,15 +1338,16 @@ err: __wt_free(session, env_config); static int __conn_home(WT_SESSION_IMPL *session, const char *home, const char *cfg[]) { - WT_DECL_RET; WT_CONFIG_ITEM cval; /* If the application specifies a home directory, use it. */ if (home != NULL) goto copy; - ret = __wt_getenv(session, "WIREDTIGER_HOME", &S2C(session)->home); - if (ret == 0) + /* Only use the environment variable if configured. */ + WT_RET(__wt_config_gets(session, cfg, "use_environment", &cval)); + if (cval.val != 0 && + __wt_getenv(session, "WIREDTIGER_HOME", &S2C(session)->home) == 0) return (0); /* If there's no WIREDTIGER_HOME environment variable, use ".". */ |