MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / start_java_project

Method start_java_project

class/plugin_deployment.py:843–880  ·  view source on GitHub ↗
(self, get)

Source from the content-addressed store, hash-verified

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):

Callers 1

Calls 13

WriteLogsMethod · 0.95
test_portMethod · 0.95
returnMsgMethod · 0.80
listdirMethod · 0.80
readFileMethod · 0.80
insertMethod · 0.45
start_projectMethod · 0.45
formatMethod · 0.45
existsMethod · 0.45
joinMethod · 0.45
searchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected