forked from tpd94/CDRM-Project
Refactor config file checks to improve path handling and add module docstring
This commit is contained in:
parent
29be40ab95
commit
c82e493ef1
@ -1,11 +1,13 @@
|
|||||||
|
"""Module to check for the config file."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def check_for_config_file():
|
def check_for_config_file():
|
||||||
if os.path.exists(f"{os.getcwd()}/configs/config.yaml"):
|
"""Check for the config file."""
|
||||||
|
if os.path.exists(os.path.join(os.getcwd(), "configs", "config.yaml")):
|
||||||
return
|
return
|
||||||
else:
|
default_config = """
|
||||||
default_config = """\
|
|
||||||
default_wv_cdm: ''
|
default_wv_cdm: ''
|
||||||
default_pr_cdm: ''
|
default_pr_cdm: ''
|
||||||
secret_key_flask: 'secretkey'
|
secret_key_flask: 'secretkey'
|
||||||
@ -22,6 +24,8 @@ remote_cdm_secret: ''
|
|||||||
# port: ''
|
# port: ''
|
||||||
# database: ''
|
# database: ''
|
||||||
"""
|
"""
|
||||||
with open(f"{os.getcwd()}/configs/config.yaml", "w") as f:
|
with open(
|
||||||
|
os.path.join(os.getcwd(), "configs", "config.yaml"), "w", encoding="utf-8"
|
||||||
|
) as f:
|
||||||
f.write(default_config)
|
f.write(default_config)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user