feat: check settings

This commit is contained in:
RTAkland
2021-12-15 21:26:36 +08:00
parent 3c019ad98c
commit e0dcf8af56
4 changed files with 26 additions and 19 deletions

View File

@@ -3,4 +3,29 @@
# @Author: markushammered@gmail.com # @Author: markushammered@gmail.com
# @Development Tool: PyCharm # @Development Tool: PyCharm
# @Create Time: 2021/12/15 # @Create Time: 2021/12/15
# @File Name: __init__.py # @File Name: __init__.py
"""
Check the configuration file
"""
import sys
from ruamel.yaml import YAML
from core.logger import Logger
with open('./config.yml', 'r') as f:
settings = YAML().load(f.read())
for mail in settings['mail-settings'].values():
if not mail:
Logger.critical('mail-settings 有未填写项目')
sys.exit(1)
for request in settings['request-settings'].values():
if not request:
Logger.critical('request-settings 有未填写项目')
sys.exit(1)
for other in settings['client-settings'].values():
if not other:
Logger.critical('client-settings 有未填写项目')
sys.exit(1)

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/12/15
# @File Name: test.py

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/12/15
# @File Name: test.py

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/12/15
# @File Name: s.py