24 lines
881 B
Python
24 lines
881 B
Python
# _*_ coding: utf-8 _*_
|
|
# @Time :2022/5/26 09:09
|
|
# @Email :508737091@qq.com
|
|
# @Author :qiangyanwen
|
|
# @File :__init__.py.py
|
|
import yaml, os
|
|
from yaml import CLoader as Loader
|
|
|
|
from utils.system import system
|
|
from entity.setting_entity import SettingModel
|
|
from config.log import logger
|
|
Debug = os.getenv("DEBUG", True)
|
|
platforms = ["darwin", "win32", "win64"]
|
|
if system in platforms:
|
|
# 启动开发环境
|
|
logger.info("start the automation service development environment")
|
|
config_file = "application_dev.yaml"
|
|
else:
|
|
# 启动生产环境
|
|
logger.info("start the automation service production environment")
|
|
config_file = "application_prod.yaml"
|
|
logger.info("loading environment configuration file")
|
|
project_path = os.path.dirname(os.path.realpath(__file__))
|
|
settings = SettingModel(**yaml.load(open(os.path.join(project_path, config_file)), Loader)) |