CDRM-Project/custom_functions/prechecks/config_file_checks.py

32 lines
727 B
Python
Raw Normal View History

"""Module to check for the config file."""
2025-04-24 17:06:14 -04:00
import os
2025-04-24 17:06:14 -04:00
def check_for_config_file():
"""Check for the config file."""
if os.path.exists(os.path.join(os.getcwd(), "configs", "config.yaml")):
2025-04-24 17:06:14 -04:00
return
default_config = """
2025-04-24 17:06:14 -04:00
default_wv_cdm: ''
default_pr_cdm: ''
2025-04-30 04:42:47 -04:00
secret_key_flask: 'secretkey'
2025-04-24 17:06:14 -04:00
# change the type to mariadb to use mariadb below
database_type: 'sqlite'
fqdn: ''
remote_cdm_secret: ''
# uncomment all the lines below to use mariadb and fill out the information
#mariadb:
# user: ''
# password: ''
# host: ''
# port: ''
# database: ''
"""
with open(
os.path.join(os.getcwd(), "configs", "config.yaml"), "w", encoding="utf-8"
) as f:
2025-04-24 17:06:14 -04:00
f.write(default_config)
return