From 15e986c158d3d9a31bb7f778070db85e24bcaa32 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 15 Jun 2020 09:44:42 -0400 Subject: [PATCH] Support storing client config in override dir --- client-cli/pvc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index d45cd973..900839eb 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -122,11 +122,14 @@ def update_store(store_path, store_data): # Ensure file has 0600 permissions due to API key storage os.chmod(store_file, 0o600) +pvc_client_dir = os.environ.get('PVC_CLIENT_DIR', None) home_dir = os.environ.get('HOME', None) -if home_dir: +if pvc_client_dir: + store_path = '{}'.format(pvc_client_dir) +elif home_dir: store_path = '{}/.config/pvc'.format(home_dir) else: - print('No home dir found - not permanently saving any configurations as this user') + print('WARNING: No client or home config dir found, using /tmp instead') store_path = '/tmp/pvc' if not os.path.isdir(store_path):