diff options
author | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2020-08-11 16:44:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 15:44:28 +0200 |
commit | cedb8707c8ce1728984da85a58d24c26ddc24ad9 (patch) | |
tree | 3b9e789a3869a37150c520b29dd35a3b13185f5b | |
parent | b0bfec14e2e1583077beead3827d29444cf05fd0 (diff) |
Fix the default value of the home directory (#9711)
Change the default home to be VARLIB_DIR instead of CACHE_DIR so that it is consistent with the installation. Override the default with the HOME var if set in the environment.
-rw-r--r-- | daemon/common.c | 2 | ||||
-rw-r--r-- | daemon/main.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/daemon/common.c b/daemon/common.c index 7cd84a9dff..45d5fa3fd9 100644 --- a/daemon/common.c +++ b/daemon/common.c @@ -11,7 +11,7 @@ char *netdata_configured_web_dir = WEB_DIR; char *netdata_configured_cache_dir = CACHE_DIR; char *netdata_configured_varlib_dir = VARLIB_DIR; char *netdata_configured_lock_dir = NULL; -char *netdata_configured_home_dir = CACHE_DIR; +char *netdata_configured_home_dir = VARLIB_DIR; char *netdata_configured_host_prefix = NULL; char *netdata_configured_timezone = NULL; int netdata_ready; diff --git a/daemon/main.c b/daemon/main.c index 4b24c85bfa..a3b63ce513 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -541,7 +541,8 @@ static void get_netdata_configured_variables() { netdata_configured_web_dir = config_get(CONFIG_SECTION_GLOBAL, "web files directory", netdata_configured_web_dir); netdata_configured_cache_dir = config_get(CONFIG_SECTION_GLOBAL, "cache directory", netdata_configured_cache_dir); netdata_configured_varlib_dir = config_get(CONFIG_SECTION_GLOBAL, "lib directory", netdata_configured_varlib_dir); - netdata_configured_home_dir = config_get(CONFIG_SECTION_GLOBAL, "home directory", netdata_configured_home_dir); + char *env_home=getenv("HOME"); + netdata_configured_home_dir = config_get(CONFIG_SECTION_GLOBAL, "home directory", env_home?env_home:netdata_configured_home_dir); netdata_configured_lock_dir = initialize_lock_directory_path(netdata_configured_varlib_dir); |