(self, get)
| 841 | print(public.get_error_info()) |
| 842 | |
| 843 | def start_java_project(self, get): |
| 844 | # 获取网站类型 |
| 845 | if '/www/server/panel' not in sys.path: |
| 846 | sys.path.insert(0, '/www/server/panel') |
| 847 | from mod.project.java.projectMod import main as java_project |
| 848 | java_project = java_project() |
| 849 | # 启动项目 |
| 850 | java_project.start_project(public.to_dict_obj({"project_name": get.project_name.strip()})) |
| 851 | |
| 852 | # 获取项目监听端口 |
| 853 | filepath = "/www/wwwroot/{}/config".format(get.site_name.strip()) |
| 854 | if not os.path.exists(filepath): |
| 855 | self.WriteLogs('ERROR:配置文件config目录不存在: {}'.format(filepath)) |
| 856 | return public.returnMsg(False, '配置文件目录不存在!') |
| 857 | |
| 858 | server_port = None |
| 859 | for file in os.listdir(filepath): |
| 860 | full_file_path = os.path.join(filepath, file) |
| 861 | if os.path.isfile(full_file_path): |
| 862 | # 读取配置文件内容 |
| 863 | content = public.readFile(full_file_path) |
| 864 | # 查找配置文件当前的端口号 |
| 865 | re_port = re.compile(r'\s*server\.port\s*=\s*(\d+)', re.M) |
| 866 | server_port = re_port.search(content) |
| 867 | if server_port: |
| 868 | server_port = server_port.group(1) |
| 869 | self.test_port(server_port) |
| 870 | |
| 871 | if server_port: |
| 872 | # 开启外网映射 代理/目录 |
| 873 | result = java_project.add_server_proxy(public.to_dict_obj({ |
| 874 | "proxy_dir": "/", |
| 875 | "proxy_port": server_port, |
| 876 | "site_name": get.project_name.strip(), |
| 877 | "rewrite": {"status": False, "src_path": "/", "target_path": "/"}, |
| 878 | "add_headers": [], |
| 879 | "status": "1", |
| 880 | })) |
| 881 | |
| 882 | # 处理临时文件 |
| 883 | def set_temp_file(self, filename, path): |
no test coverage detected