# coding=utf-8 import os import configparser # 配置文件路径 HERE = os.path.dirname(os.path.abspath(__file__)) ROOT_PATH = os.path.abspath(os.path.join(HERE, '../../')) ASTWB_PATH = os.path.abspath(os.path.join(HERE, '../../ASTWB/library/Config/')) env_choose_path = os.path.join(HERE, 'env_choose.ini') config_choose_path = os.path.join(HERE, 'config.ini') la_config_path = os.path.join(HERE, '../platform_tools/jira_tools/la_config.ini') config_evn_path = os.path.join(HERE, 'current_pth.py') server_ip_path = os.path.join(HERE, 'server_ip.ini') log_path = os.path.join(ROOT_PATH, 'Log') # 根据启动参数来加载对应的配置文件 cof = configparser.ConfigParser() cof.read(env_choose_path) current_business = cof['run_evn_name']['current_business'].lower() current_evn = cof['run_evn_name']['current_evn'].lower() config_file_path = os.path.join(HERE, 'config_{0}_{1}.ini'.format(current_business, current_evn)) db_config_path = config_file_path pz_all_server_ip_path = os.path.join(HERE, 'pz_all_server_ip.ini') swagger_choose_path = os.path.join(HERE, 'swagger_url.ini') astwb_config = os.path.join(ASTWB_PATH, 'team_config.ini') uat_config_path = os.path.abspath(os.path.join(HERE, 'uat_config')) if __name__ == '__main__': print(config_file_path)