-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from isd-sgcu/dev
update main
- Loading branch information
Showing
14 changed files
with
199 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM mcr.microsoft.com/devcontainers/go:1-1.21-bookworm | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
# [Optional] Uncomment the next lines to use go get to install anything else you need | ||
# USER vscode | ||
# RUN go get -x <your-dependency-or-tool> | ||
# USER root | ||
|
||
# [Optional] Uncomment this line to install global node packages. | ||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/go-postgres | ||
{ | ||
"name": "RPKM67 Auth Service", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"aldijav.golangwithdidi", | ||
"VisualStudioExptTeam.vscodeintellicode", | ||
"VisualStudioExptTeam.vscodeintellicode-completions", | ||
"ZainChen.json", | ||
"ms-kubernetes-tools.vscode-kubernetes-tools", | ||
"ms-vscode.makefile-tools", | ||
"DavidAnson.vscode-markdownlint", | ||
"esbenp.prettier-vscode", | ||
"christian-kohler.path-intellisense", | ||
"zxh404.vscode-proto3", | ||
"redhat.vscode-yaml", | ||
"ms-azuretools.vscode-docker", | ||
"aaron-bond.better-comments" | ||
] | ||
} | ||
}, | ||
"forwardPorts": [ | ||
5432, | ||
6379 | ||
], | ||
"postStartCommand": "make setup" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3.8' | ||
|
||
volumes: | ||
postgres-data: | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
command: sleep infinity | ||
network_mode: service:db | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
network_mode: service:redis | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
env_file: | ||
- .env | ||
|
||
redis: | ||
image: redis:latest | ||
restart: unless-stopped | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./redis-data:/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for more information: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://containers.dev/guide/dependabot | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,6 @@ coverage.html | |
|
||
tmp | ||
staff.json | ||
docker-compose.qa.yml | ||
docker-compose.qa.yml | ||
|
||
.devcontainer/*-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
package store | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"io" | ||
|
||
"github.com/minio/minio-go/v7" | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/s3" | ||
) | ||
|
||
type Client interface { | ||
PutObject(ctx context.Context, bucketName string, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) | ||
RemoveObject(ctx context.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error | ||
PutObject(ctx context.Context, bucketName string, objectName string, reader *bytes.Reader) (info *s3.PutObjectOutput, err error) | ||
RemoveObject(ctx context.Context, bucketName string, objectName string) error | ||
} | ||
|
||
type clientImpl struct { | ||
*minio.Client | ||
*s3.S3 | ||
} | ||
|
||
func NewClient(minioClient *minio.Client) Client { | ||
return &clientImpl{minioClient} | ||
func NewClient(s3Client *s3.S3) Client { | ||
return &clientImpl{s3Client} | ||
} | ||
|
||
func (c *clientImpl) PutObject(ctx context.Context, bucketName string, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (info minio.UploadInfo, err error) { | ||
return c.Client.PutObject(ctx, bucketName, objectName, reader, objectSize, opts) | ||
func (c *clientImpl) PutObject(ctx context.Context, bucketName string, objectName string, reader *bytes.Reader) (info *s3.PutObjectOutput, err error) { | ||
return c.S3.PutObject(&s3.PutObjectInput{ | ||
Bucket: &bucketName, | ||
Key: &objectName, | ||
Body: reader, | ||
ACL: aws.String(s3.ObjectCannedACLPublicRead), | ||
}) | ||
} | ||
|
||
func (c *clientImpl) RemoveObject(ctx context.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error { | ||
return c.Client.RemoveObject(ctx, bucketName, objectName, opts) | ||
func (c *clientImpl) RemoveObject(ctx context.Context, bucketName string, objectName string) error { | ||
_, err := c.S3.DeleteObject(&s3.DeleteObjectInput{ | ||
Bucket: &bucketName, | ||
Key: &objectName, | ||
}) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.