File tree Expand file tree Collapse file tree 10 files changed +30
-4
lines changed
Expand file tree Collapse file tree 10 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,13 @@ func (r *RuntimeRepo) WithNotId(id uint) DBOption {
6464func (r * RuntimeRepo ) WithPort (port int ) DBOption {
6565 return func (g * gorm.DB ) * gorm.DB {
6666 portStr := fmt .Sprintf ("%d" , port )
67- regexPattern := fmt .Sprintf ("(^|,)%s(,|$)" , portStr )
68- return g .Where ("port REGEXP ?" , regexPattern )
67+ return g .Debug ().Where (
68+ "port = ? OR port LIKE ? OR port LIKE ? OR port LIKE ?" ,
69+ portStr ,
70+ portStr + ",%" ,
71+ "%," + portStr ,
72+ "%," + portStr + ",%" ,
73+ )
6974 }
7075}
7176
Original file line number Diff line number Diff line change @@ -1022,11 +1022,15 @@ func (r *RuntimeService) UpdatePHPContainer(req request.PHPContainerConfig) erro
10221022 return err
10231023 }
10241024 var (
1025- hostPorts []string
10261025 composeContent []byte
10271026 )
10281027 for _ , export := range req .ExposedPorts {
1029- hostPorts = append (hostPorts , strconv .Itoa (export .HostPort ))
1028+ if strconv .Itoa (export .HostPort ) == runtime .Port {
1029+ return buserr .WithName ("ErrPHPRuntimePortFailed" , strconv .Itoa (export .HostPort ))
1030+ }
1031+ if export .ContainerPort == 9000 {
1032+ return buserr .New ("ErrPHPPortIsDefault" )
1033+ }
10301034 if err = checkRuntimePortExist (export .HostPort , false , runtime .ID ); err != nil {
10311035 return err
10321036 }
@@ -1075,6 +1079,7 @@ func (r *RuntimeService) UpdatePHPContainer(req request.PHPContainerConfig) erro
10751079 for k , v := range newMap {
10761080 envs [k ] = v
10771081 }
1082+ envs ["PANEL_APP_PORT_HTTP" ] = runtime .Port
10781083 envStr , err := gotenv .Marshal (envs )
10791084 if err != nil {
10801085 return err
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'The scripts configuration item was not found in package.jso
183183ErrContainerNameNotFound : ' Unable to get container name, please check .env file'
184184ErrNodeModulesNotFound : ' The node_modules folder does not exist! Please edit the runtime environment or wait for the runtime environment to start successfully'
185185ErrContainerNameIsNull : ' Container name does not exist'
186+ ErrPHPPortIsDefault : " Port 9000 is the default port, please modify and try again"
187+ ErrPHPRuntimePortFailed : " The port {{ .name }} is already used by the current runtime environment, please modify and try again"
186188
187189# tool
188190ErrConfigNotFound : ' Configuration file does not exist'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'スクリプト構成項目が package.json に見つかり
183183ErrContainerNameNotFound : ' コンテナ名を取得できません。.env ファイルを確認してください'
184184ErrNodeModulesNotFound : ' node_modules フォルダが存在しません。ランタイム環境を編集するか、ランタイム環境が正常に起動するまでお待ちください。'
185185ErrContainerNameIsNull : ' コンテナ名が存在しません'
186+ ErrPHPPortIsDefault : " ポート9000はデフォルトポートです。修正してから再試行してください"
187+ ErrPHPRuntimePortFailed : " ポート {{ .name }} は現在のランタイム環境で使用されています。修正してから再試行してください"
186188
187189# tool
188190ErrConfigNotFound : ' 構成ファイルが存在しません'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'package.json에서 스크립트 구성 항목을 찾을 수
183183ErrContainerNameNotFound : ' 컨테이너 이름을 가져올 수 없습니다. .env 파일을 확인하세요.'
184184ErrNodeModulesNotFound : ' node_modules 폴더가 없습니다! 런타임 환경을 편집하거나 런타임 환경이 성공적으로 시작될 때까지 기다리십시오'
185185ErrContainerNameIsNull : ' 컨테이너 이름이 존재하지 않습니다'
186+ ErrPHPPortIsDefault : " 9000 포트는 기본 포트입니다. 수정 후 다시 시도하세요"
187+ ErrPHPRuntimePortFailed : " 포트 {{ .name }} 는 현재 런타임 환경에서 이미 사용 중입니다. 수정 후 다시 시도하세요"
186188
187189# 도구
188190ErrConfigNotFound : ' 구성 파일이 존재하지 않습니다'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'Item konfigurasi skrip tidak ditemui dalam package.json'
183183ErrContainerNameNotFound : ' Tidak dapat mendapatkan nama kontena, sila semak fail .env'
184184ErrNodeModulesNotFound : ' Folder node_modules tidak wujud! Sila edit persekitaran masa jalan atau tunggu persekitaran masa jalan berjaya dimulakan'
185185ErrContainerNameIsNull : ' Nama kontena tidak wujud'
186+ ErrPHPPortIsDefault : " Порт 9000 является портом по умолчанию, пожалуйста, измените и попробуйте снова"
187+ ErrPHPRuntimePortFailed : " Порт {{ .name }} уже используется текущей средой выполнения, пожалуйста, измените и попробуйте снова"
186188
187189# alat
188190ErrConfigNotFound : ' Fail konfigurasi tidak wujud'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'O item de configuração de scripts não foi encontrado em
183183ErrContainerNameNotFound : ' Não foi possível obter o nome do contêiner, verifique o arquivo .env'
184184ErrNodeModulesNotFound : ' A pasta node_modules não existe! Edite o ambiente de execução ou aguarde até que o ambiente de execução inicie com sucesso'
185185ErrContainerNameIsNull : ' O nome do contêiner não existe'
186+ ErrPHPPortIsDefault : " Port 9000 adalah port lalai, sila ubah dan cuba lagi"
187+ ErrPHPRuntimePortFailed : " Port {{ .name }} telah digunakan oleh persekitaran runtime semasa, sila ubah dan cuba lagi"
186188
187189# ferramenta
188190ErrConfigNotFound : ' O arquivo de configuração não existe'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: 'Элемент конфигурации скриптов н
183183ErrContainerNameNotFound : ' Не удалось получить имя контейнера, проверьте файл .env'
184184ErrNodeModulesNotFound : ' Папка node_modules не существует! Измените среду выполнения или дождитесь ее успешного запуска'
185185ErrContainerNameIsNull : ' Имя контейнера не существует'
186+ ErrPHPPortIsDefault : " A porta 9000 é a porta padrão, por favor, modifique e tente novamente"
187+ ErrPHPRuntimePortFailed : " A porta {{ .name }} já está sendo usada pelo ambiente de tempo de execução atual, por favor, modifique e tente novamente"
186188
187189# инструмент
188190ErrConfigNotFound : ' Файл конфигурации не существует'
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ ErrScriptsNotFound: '沒有在package.json 中找到scripts 設定項'
183183ErrContainerNameNotFound : ' 無法取得容器名稱,請檢查.env 檔案'
184184ErrNodeModulesNotFound : ' node_modules 資料夾不存在!請編輯運行環境或等待運行環境啟動成功'
185185ErrContainerNameIsNull : ' 容器名稱不存在'
186+ ErrPHPPortIsDefault : " 9000 端口為默認端口,請修改後重試"
187+ ErrPHPRuntimePortFailed : " {{ .name }} 端口已被當前運行環境使用,請修改後重試"
186188
187189# tool
188190ErrConfigNotFound : ' 設定檔不存在'
Original file line number Diff line number Diff line change @@ -182,6 +182,8 @@ ErrScriptsNotFound: "没有在 package.json 中找到 scripts 配置项"
182182ErrContainerNameNotFound : " 无法获取容器名称,请检查 .env 文件"
183183ErrNodeModulesNotFound : " node_modules 文件夹不存在!请编辑运行环境或者等待运行环境启动成功"
184184ErrContainerNameIsNull : " 容器名称不存在"
185+ ErrPHPPortIsDefault : " 9000 端口为默认端口,请修改后重试"
186+ ErrPHPRuntimePortFailed : " {{ .name }} 端口已被当前运行环境使用,请修改后重试"
185187
186188# tool
187189ErrConfigNotFound : " 配置文件不存在"
You can’t perform that action at this time.
0 commit comments