Skip to content

Conversation

@amuschtagow
Copy link
Contributor

CS-16
What:
Реализована работа сервиса в Docker контейнере.
Why:
Для быстрого развертывания в любой инфраструктуре.
How:
В корень проекта добавлены файлы: Dockerfile, .dockerignore, protoc_options_generate.txt
В файл README.md добавлена инструкция запуска сервиса в Docker контейнере.

Dockerfile Outdated
@@ -0,0 +1,36 @@
FROM golang:1.19.3 as app_builder
Copy link
Collaborator

Choose a reason for hiding this comment

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

alpine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Debian bullseye -
ок на alpine переделаю

Status status = 1;
}

message DelTemplateResp {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не стоит скоращатьназвания - потом больно будет.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

исправил

package server

import (
"context"
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: мы обычно сортируем импорты иначе

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Вручную сортируете?
У меня сами gofmt и goimports сортируют.
Как нужно?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

исправил

return server, nil
}

func (c *certificateServer) IssueCertificate(ctx context.Context, req *certSPb.IssueCertificateReq) (*certSPb.IssueCertificateResp, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Разбить эту функцию. Очень уж длиннная

Copy link
Contributor Author

Choose a reason for hiding this comment

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

часть функционала вытащил в метод fillData. Еще разбить?

}

// Генерация ID/имени сертификата (ID + ".pdf").
nameCertificateIdPDF := c.certGen.GenerateID() + ".pdf"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут бы по-хорошему usecase вставить, так получается сильная связность между сервером(транспорт) и бизнес логикой.
Пока можно и так, но это уэе хороший запрос на сказ о чистой архитектуре.

Copy link
Contributor Author

@amuschtagow amuschtagow Nov 18, 2022

Choose a reason for hiding this comment

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

Изменил, сделал так:
certificateId := c.certGen.GenerateID()

Расширение файла добавляется только при отправке и поиске в хранилище:
certificateId+certificateFileExtension

cmd/rpc/main.go Outdated
)

func main() {
host := "0.0.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

в env!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

сделал


import "github.com/skip2/go-qrcode"

const sizeImage = 128
Copy link
Collaborator

Choose a reason for hiding this comment

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

по идее это свойство шаблона

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Да, но при генерации QR нужно указать какой-то размер. Поставил 128 как оптимальный.
В шаблоне же указываются размер <img src={{.QrCodeLink}} width="128" height="128">
И наш QR автоматически впишется в эти размеры.
Чтоб генерировать QR размером как в шаблоне можно конечно из HTML шаблона вытащить его размеры.
Но создатели шаблона могут вообще размеры не задавать, тогда QR будет в документе того размера как есть.
Сделать так, брать размеры QR из шаблона?

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.

3 participants