[wgem] config | allowing to use system nativefier

This commit is contained in:
Vinícius Moreira
2019-12-17 15:23:40 -03:00
parent f12b653393
commit e87c95ea9e
5 changed files with 73 additions and 18 deletions

22
bauh/gems/web/config.py Normal file
View File

@@ -0,0 +1,22 @@
import os
from pathlib import Path
import yaml
from bauh.api.constants import CONFIG_PATH
from bauh.gems.web import CONFIG_FILE
def read_config() -> dict:
if not os.path.exists(CONFIG_FILE):
config = {'environment': {'system': False}}
Path(CONFIG_PATH).mkdir(parents=True, exist_ok=True)
with open(CONFIG_FILE, 'w+') as f:
f.write(yaml.dump(config))
else:
with open(CONFIG_FILE) as f:
config = yaml.safe_load(f.read())
return config