Support storing client config in override dir

This commit is contained in:
Joshua Boniface 2020-06-15 09:44:42 -04:00
parent 5871380e1b
commit 15e986c158
1 changed files with 5 additions and 2 deletions

View File

@ -122,11 +122,14 @@ def update_store(store_path, store_data):
# Ensure file has 0600 permissions due to API key storage # Ensure file has 0600 permissions due to API key storage
os.chmod(store_file, 0o600) os.chmod(store_file, 0o600)
pvc_client_dir = os.environ.get('PVC_CLIENT_DIR', None)
home_dir = os.environ.get('HOME', 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) store_path = '{}/.config/pvc'.format(home_dir)
else: 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' store_path = '/tmp/pvc'
if not os.path.isdir(store_path): if not os.path.isdir(store_path):