-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
The-Gleb
commented
Mar 17, 2024
- Add asymmetric encryption
- Add parsing config from json
- Graceful shutdown on SIGTERM,SIGQUIT,SIGINT
Не понимаю, как правильно установить поле restore в конфиге |
return b | ||
} | ||
|
||
// TODO: it is unclear wether 'false' returned by -r flag is default or it was set by flag. |
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.
Существует несколько подходов к решению этой проблемы:
- Анмаршалить bool в
json.RawMessage
(https://pkg.go.dev/encoding/json#RawMessage) и проверять его - использовать какую-то библиотеку типа
mergo
, которая под капотом также анмаршалит сообщение в несколько проходов - перевернуть флаг (передавать
noRestore
вместоrestore
)
Кажется, что первый вариант наиболее адекватен в данном случае
cmd/server/config.go
Outdated
|
||
err = env.Parse(&builder.config) | ||
if err != nil { | ||
log.Fatal(err) |
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.
Не стоит вызывать Fatal
из глубины кода: лучше прокинуть ошибку наверх и вызвать из main
golangci-lint/report.json
Outdated
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.
Это не стоит пушить в репо
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.
Это не стоит пушить в репо
|
||
func NewDecryptionMiddleware(path string) *decryptionMiddleware { | ||
if path == "" { | ||
logger.Log.Info("path to private key is empty") |
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.
Если логировать это на уровне Info
, то лог будет забиваться очень быстро. Наверное, стоит выбрать Debug
http.Error(rw, err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
// logger.Log.Debugf("request body is %s", string(cipher)) |
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.
deadcode
server
Outdated
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.
Это не надо пушить