From 7fbfb3fd266c6021c91fdfd95548c5413d351e70 Mon Sep 17 00:00:00 2001 From: atridadl Date: Sat, 20 Jan 2024 01:39:52 -0700 Subject: [PATCH] Console logs and region var --- .env.example | 8 +++++++- lib/s3.go | 4 ++-- main.go | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index c32c45f..8ccffd4 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,10 @@ DISCORD_TOKEN="" REPLICATE_API_TOKEN="" # Comma separated -COOLDOWN_ALLOW_LIST="" \ No newline at end of file +COOLDOWN_ALLOW_LIST="" +# S3 +BUCKET_NAME= +AWS_ENDPOINT_URL_S3= +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_REGION= \ No newline at end of file diff --git a/lib/s3.go b/lib/s3.go index 51cc428..d927fc1 100644 --- a/lib/s3.go +++ b/lib/s3.go @@ -12,7 +12,6 @@ import ( func UploadToS3(filePath string) (*s3manager.UploadOutput, error) { bucket := os.Getenv("BUCKET_NAME") - fmt.Println("The filepath is: ", filePath) if bucket == "" { fmt.Println("No S3 bucket specified, skipping upload.") return nil, nil @@ -21,9 +20,10 @@ func UploadToS3(filePath string) (*s3manager.UploadOutput, error) { endpoint := os.Getenv("AWS_ENDPOINT_URL_S3") accessKeyID := os.Getenv("AWS_ACCESS_KEY_ID") secretAccessKey := os.Getenv("AWS_SECRET_ACCESS_KEY") + region := os.Getenv("AWS_REGION") sess, err := session.NewSession(&aws.Config{ - Region: aws.String("us-west-2"), + Region: ®ion, Credentials: credentials.NewStaticCredentials( accessKeyID, secretAccessKey, diff --git a/main.go b/main.go index 72fc607..7a3b950 100644 --- a/main.go +++ b/main.go @@ -189,7 +189,6 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In // Concatenate clean username and timestamp to form filename filename := data.Event.Sender().Username + "_" + timestamp + ".jpg" - fmt.Println("The filename is: ", filename) imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)