-
Notifications
You must be signed in to change notification settings - Fork 1
Implemented minio storage #26
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
base: master
Are you sure you want to change the base?
Conversation
| return buffer, nil | ||
| } | ||
|
|
||
| func (m minioStorage) GetCertificate(certificateName string) ([]byte, error) { |
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.
Это не очень хорошо - должна быть функция GetFile(path) ([]byte, error) у имплементации s3, и к ней GetCertificate(certificateName string) ([]byte, error) и GetTemplate(certificateName string) ([]byte, error)
как обёртки. Но дучше пока оставить как есть.
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.
Ок...пока оставляем как есть, потом правим на GetFile.
| "log" | ||
| ) | ||
|
|
||
| func main() { |
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.
Завтра займусь тестом.
app/main.go
Outdated
|
|
||
| func main() { | ||
| endpoint := "localhost:9000" | ||
| accessKey := "..." //необходимо вписать для проверки |
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.
Так даже в тесте нельзя делать - os.Getenv()
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.
Добавил пока в файл main.go применение переменных окружения. В корень проекта добавил файл .env.
В main.go применена библиотека godotenv.
| @@ -1 +1,164 @@ | |||
| package s3 | |||
|
|
|||
| import ( | |||
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.
Подправил.
utils/storage/s3/s3.go
Outdated
|
|
||
| obj, err := m.client.GetObject(ctx, bucketName, objectName, minio.GetObjectOptions{}) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("Template not getted!") |
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.
to get - неправильный глагол.
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.
Подправил.
| "github.com/minio/minio-go/v7/pkg/credentials" | ||
| "gus_certificates/utils/storage" | ||
| "io" | ||
| "log" |
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.
Логгер мы же взяли сторонний
|
Добавил .env файл с переменными окружения и включил их пока в файл main.go (завтра если не втуплю где-нибудь заменю файл main на тесты). |
Реализовано хранилище s3(minio).
Для тестового запуска и проверки работоспособности создал файл /app/main.go, в котором необходимо будет вписать ключи хранилища. Также в папке app добавлены два файла: шаблон и сертификат для теста хранилища.