-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Поддержка кастомных эндпоинтов #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| #Использовать "../internal" | ||
| #Использовать 1connector | ||
|
|
||
| Перем _Помощник; // ПомощникПодготовкиОтветов | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| #Использовать autumn | ||
| #Использовать autumn-cli | ||
| #Использовать winow | ||
| #Использовать "." | ||
| #Использовать "../internal" | ||
|
|
||
| ПодключательКастомныхКонтроллеров = Новый ПодключательКастомныхКонтроллеров(); | ||
| ПодключательКастомныхКонтроллеров.НайтиИПодключить(); | ||
|
|
||
| Поделка = Новый Поделка; | ||
| Поделка.ЗапуститьПриложение(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
|
|
||
| #Использовать winow | ||
|
|
||
| Перем _Хост; // Строка | ||
| Перем _Порт; // Число | ||
|
|
||
| &Пластилин("Настройки") | ||
| Перем _НастройкиВебСервера; // Настройки - см. winow | ||
|
|
||
| &Пластилин("ЗапускательВебПриложения") | ||
| Перем _ЗапускательВебПриложения; // ЗапускательВебПриложения - см. winow | ||
|
|
||
| &Желудь | ||
| Процедура ПриСозданииОбъекта() | ||
| КонецПроцедуры | ||
|
|
||
| // Запускает сервис через winow | ||
| // | ||
| // Параметры: | ||
| // Хост - Строка - IP-адрес или имя хоста | ||
| // Порт - Число - Номер TCP-порта | ||
| Процедура Запустить(Хост, Порт) Экспорт | ||
|
|
||
| _Хост = Хост; | ||
| _Порт = Порт; | ||
|
|
||
| НастроитьВебСервер(); | ||
|
|
||
| _ЗапускательВебПриложения.Запустить(); | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| Процедура НастроитьВебСервер() | ||
|
|
||
| _НастройкиВебСервера.РазмерБуфера = 0; | ||
| _НастройкиВебСервера.ИмяХоста = _Хост; | ||
| _НастройкиВебСервера.Порт = _Порт; | ||
|
|
||
| Если ПолучитьПеременнуюСреды("HTTPBIN_IS_TEST_MODE") = "true" Тогда | ||
| _НастройкиВебСервера.ЗадержкаПередЧтениемСокета = 400; | ||
| КонецЕсли; | ||
|
|
||
| КонецПроцедуры |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #Использовать fs | ||
|
|
||
| #Область ПрограммныйИнтерфейс | ||
|
|
||
| // Находит и подключает кастомные контроллеры из путей, указанных в аргументах командной строки. | ||
| // | ||
| Процедура НайтиИПодключить() Экспорт | ||
|
|
||
| МассивФайлов = НайтиФайлыИзПереданныхАргументов(); | ||
|
|
||
| Для Каждого ПолноеИмя Из МассивФайлов Цикл | ||
|
|
||
| Если ФС.КаталогСуществует(ПолноеИмя) Тогда | ||
| ПодключитьИзКаталога(ПолноеИмя); | ||
| ИначеЕсли ФС.ФайлСуществует(ПолноеИмя) Тогда | ||
| Подключить(ПолноеИмя); | ||
| Иначе | ||
| ВызватьИсключение СтрШаблон("Не удалось подключить контроллер '%1': файл не существует", ПолноеИмя); | ||
| КонецЕсли; | ||
|
|
||
| КонецЦикла; | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| // Подключает контроллер из указанного файла. | ||
| // | ||
| // Параметры: | ||
| // ПолноеИмя - Строка - Полный путь к файлу контроллера (.os) | ||
| // | ||
| Процедура Подключить(ПолноеИмя) Экспорт | ||
|
|
||
| Имя = Новый Файл(ПолноеИмя).ИмяБезРасширения; | ||
|
|
||
| Попытка | ||
| ПодключитьСценарий(ПолноеИмя, Имя); | ||
| Исключение | ||
| ВызватьИсключение СтрШаблон( | ||
| "Не удалось подключить контроллер '%1': %2", | ||
| ПолноеИмя, | ||
| КраткоеПредставлениеОшибки(ИнформацияОбОшибке()) | ||
| ); | ||
| КонецПопытки; | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| #КонецОбласти | ||
|
|
||
| #Область СлужебныеПроцедурыИФункции | ||
|
|
||
| Процедура ПодключитьИзКаталога(Каталог) | ||
|
|
||
| Файлы = НайтиФайлы(Каталог, "*.os"); | ||
|
|
||
| Для Каждого Файл Из Файлы Цикл | ||
| Подключить(Файл.ПолноеИмя); | ||
| КонецЦикла; | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| Функция НайтиФайлыИзПереданныхАргументов() | ||
|
|
||
| Файлы = Новый Массив(); | ||
|
|
||
| НайденКлюч = Ложь; | ||
| Для Каждого Значение Из АргументыКоманднойСтроки Цикл | ||
|
|
||
| Если НайденКлюч Тогда | ||
| Файлы.Добавить(Значение); | ||
| НайденКлюч = Ложь; | ||
| Продолжить; | ||
| КонецЕсли; | ||
|
|
||
| Если Значение = "--routes-handlers" Тогда | ||
| НайденКлюч = Истина; | ||
| КонецЕсли; | ||
|
|
||
| КонецЦикла; | ||
|
|
||
| Возврат Файлы; | ||
|
|
||
| КонецФункции | ||
|
|
||
| #КонецОбласти | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix argument parsing to collect all values after the flag.
The current implementation only collects ONE value immediately after each
--routes-handlersflag occurrence. If a user passes multiple paths like--routes-handlers file1.os file2.os, onlyfile1.oswill be collected andfile2.oswill be silently dropped.This silent data loss can lead to confusion and missing controller registrations.
Apply this diff to collect all values after the flag until the next flag is encountered:
This change allows collecting multiple paths:
--routes-handlers file1.os file2.os file3.oswhile still supporting repeated flags:--routes-handlers file1.os --routes-handlers file2.os.🤖 Prompt for AI Agents