1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-19 13:37:58 +01:00

Added warning if config file doesn't exists.

This commit is contained in:
2021-05-14 13:46:15 +02:00
parent f6a458e1f9
commit 3b59622a68

6
box.py
View File

@@ -285,10 +285,14 @@ class Config:
conf = yaml.safe_load(USER_DATA) conf = yaml.safe_load(USER_DATA)
# read user custom cloud config (if present) and update config dict # read user custom cloud config (if present) and update config dict
if self.user_data and os.path.exists(self.user_data): if self.user_data:
if os.path.exists(self.user_data):
with open(self.user_data) as fobj: with open(self.user_data) as fobj:
custom_conf = yaml.safe_load(fobj) custom_conf = yaml.safe_load(fobj)
conf = self._update(conf, custom_conf) conf = self._update(conf, custom_conf)
else:
print(f"WARNING: Provided user_data: {self.user_data} doesn't"
" exists.")
# update the attributes with data from read user cloud config # update the attributes with data from read user cloud config
for key, val in conf.get('boxpy_data', {}).items(): for key, val in conf.get('boxpy_data', {}).items():