(self, proxy_data: dict)
| 453 | return err_msg |
| 454 | |
| 455 | def create_proxy(self, proxy_data: dict) -> Optional[str]: |
| 456 | for i in self.config: |
| 457 | if i["proxy_dir"] == proxy_data["proxy_dir"]: |
| 458 | proxy_data["proxy_id"] = i["proxy_id"] |
| 459 | return self.modify_proxy(proxy_data) |
| 460 | |
| 461 | if self.ws_type == "nginx": |
| 462 | err_msg = self.check_location(proxy_data["proxy_dir"]) |
| 463 | if err_msg: |
| 464 | return json_response(False, err_msg) |
| 465 | |
| 466 | self._set_nginx_proxy_base() |
| 467 | error_msg = self.add_nginx_proxy(proxy_data) |
| 468 | if self.ws_type == "nginx" and error_msg: |
| 469 | return error_msg |
| 470 | error_msg = self.add_apache_proxy(proxy_data) |
| 471 | if self.ws_type == "apache" and error_msg: |
| 472 | return error_msg |
| 473 | self.config.append(proxy_data) |
| 474 | self.save_config() |
| 475 | service_reload() |
| 476 | |
| 477 | def modify_proxy(self, proxy_data: dict) -> Optional[str]: |
| 478 | idx = None |
no test coverage detected