timeweb s3
This commit is contained in:
parent
edf010efae
commit
e6c8f91842
11
dal/dal.go
11
dal/dal.go
@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
bucket = "3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b"
|
||||
bucketAnswers = "squizanswer"
|
||||
)
|
||||
|
||||
@ -16,21 +17,13 @@ type Storer struct {
|
||||
}
|
||||
|
||||
func New(ctx context.Context, minioClient *minio.Client) (*Storer, error) {
|
||||
if ok, err := minioClient.BucketExists(ctx, bucketAnswers); !ok {
|
||||
if err := minioClient.MakeBucket(ctx, bucketAnswers, minio.MakeBucketOptions{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Storer{
|
||||
client: minioClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Storer) PutAnswer(ctx context.Context, file io.Reader, quizId, name string, question uint64, size int64) error {
|
||||
if _, err := s.client.PutObject(ctx, bucketAnswers, fmt.Sprintf("%s/%d/%s", quizId, question, name), file, size,
|
||||
if _, err := s.client.PutObject(ctx, bucket, bucketAnswers + "/" +fmt.Sprintf("%s/%d/%s", quizId, question, name), file, size,
|
||||
minio.PutObjectOptions{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
answerer:
|
||||
hostname: squiz-answerer
|
||||
container_name: squiz-answerer
|
||||
answererv1.0.0:
|
||||
hostname: squiz-answererv1.0.0
|
||||
container_name: squiz-answererv1.0.0
|
||||
image: $CI_REGISTRY_IMAGE/staging-answerer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
|
||||
tty: true
|
||||
environment:
|
||||
@ -9,12 +10,12 @@ services:
|
||||
IS_PROD: 'false'
|
||||
PUBLIC_ACCESS_SECRET_KEY: $JWT_PUBLIC_KEY
|
||||
PORT: 1490
|
||||
MINIO_EP: 'storage.yandexcloud.net'
|
||||
MINIO_AK: 'YCAJEOcqqTHpiwL4qFwLfHPNA'
|
||||
MINIO_SK: 'YCNIAIat0XqdDzycWsYKX3OU7mPor6S0WmMoG4Ry'
|
||||
MINIO_EP: s3.timeweb.cloud
|
||||
MINIO_AK: 5CV77KVDUU9H0II9R24M
|
||||
MINIO_SK: '0W0m8DyvdAKRJnsAy6mB5zndQ7RouJBLhqhtThcu'
|
||||
PG_CRED: 'host=10.8.0.5 port=5433 user=squiz password=Redalert2 dbname=squiz sslmode=disable'
|
||||
REDIS_HOST: '10.8.0.5:6379'
|
||||
REDIS_PASSWORD: 'Redalert2'
|
||||
REDIS_DB: 2
|
||||
ports:
|
||||
- 10.8.0.5:1490:1490
|
||||
- 10.8.0.5:1491:1490
|
||||
|
Loading…
Reference in New Issue
Block a user