Skip to content
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

iter23 #22

Merged
merged 3 commits into from
Dec 6, 2023
Merged

iter23 #22

merged 3 commits into from
Dec 6, 2023

Conversation

alexlzrv
Copy link
Owner

No description provided.

Copy link

@valentinsoe valentinsoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо за работу.
Часть замечаний написал в комментариях.
Из того что там нет - не реализовано задание 23 инкремента совсем(обработка сигналов)

if cfg.ConfigPath != "" {
cfgJSON, err := readConfigFile(cfg.ConfigPath)
if err != nil {
return cfgJSON, err

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем соответствует заданию. Конфигурация из JSON имеет наименьший приоритет.

return
}

privateKeyPEM, err := os.ReadFile(privateKeyPath)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На каждый запрос заново читать и парсить ключи кажется избыточным.
Лучше делать это однажды при старте приложения, а если мы ожидаем, что они будут меняться во время приложения - делать механизм "перечитывания" конфигурации.

)

func encrypt(publicKeyPath string, data []byte) ([]byte, error) {
publicKeyPEM, err := os.ReadFile(publicKeyPath)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут такая же проблема как в декрипте - каждый раз заново читать файл плохо.

return false, fmt.Errorf("error create post request %w", err)
}
return true, nil
}

func SendBatchJSON(url string, metricsBatch []*metrics.Metrics, signKey []byte) error {
func SendBatchJSON(url string, metricsBatch []*metrics.Metrics, signKey []byte, publicKey string) error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не предлагаю это сейчас исправлять. Но кажется архитектурно не самый удачный подход передавать столько параметров. Можно настроить объект и передавать ему при каждом вызове только меняющиеся данные(метрики)

Copy link

@valentinsoe valentinsoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо за работу.
Посмотрел, действительно работа с сигналами уже была.

@alexlzrv alexlzrv merged commit 3345ee3 into main Dec 6, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants