1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 04:49:37 +02:00

chore: Update S3 endpoint configuration to use AWS_S3_ENDPOINT

This commit is contained in:
Sean Morley 2024-06-14 12:00:57 +00:00
parent 272ea60057
commit a0cbb826f7
3 changed files with 8 additions and 8 deletions

View file

@ -5,5 +5,5 @@ DATABASE_URL=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
VITE_AWS_S3_ENDPOINT=
AWS_S3_ENDPOINT=
AWS_REGION=

View file

@ -11,9 +11,9 @@ services:
- SKIP_DB_WAIT=false
- AWS_ACCESS_KEY_ID=minioadmin
- AWS_SECRET_ACCESS_KEY=minioadmin
- VITE_AWS_S3_ENDPOINT=http://minio:9000
# VITE_MINIO_CLIENT_OVERRIDE: Only necessary if using minio here with this docker compose file. This is becaues the client needs a different endpoint than the server because its not in the docker network.
- VITE_MINIO_CLIENT_OVERRIDE=http://localhost:9000
- AWS_S3_ENDPOINT=http://minio:9000
# MINIO_CLIENT_OVERRIDE: Only necessary if using minio here with this docker compose file. This is becaues the client needs a different endpoint than the server because its not in the docker network.
- MINIO_CLIENT_OVERRIDE=http://localhost:9000
- BODY_SIZE_LIMIT=Infinity # change this to a smaller value if you want to limit the size of uploaded files!
depends_on:

View file

@ -19,7 +19,7 @@ const s3Config: S3ClientConfig = {
accessKeyId: env.AWS_ACCESS_KEY_ID as string,
secretAccessKey: env.AWS_SECRET_ACCESS_KEY as string,
},
endpoint: env.VITE_AWS_S3_ENDPOINT, // Add the endpoint
endpoint: env.AWS_S3_ENDPOINT, // Add the endpoint
forcePathStyle: true,
};
@ -146,10 +146,10 @@ export const deleteObject = async (bucketName: string, fileName: string) => {
export const getObjectUrl = (bucketName: string, fileName: string): string => {
let objectUrl: string;
let endpoint: string = "";
if (env.VITE_MINIO_CLIENT_OVERRIDE) {
endpoint = env.VITE_MINIO_CLIENT_OVERRIDE as string;
if (env.MINIO_CLIENT_OVERRIDE) {
endpoint = env.MINIO_CLIENT_OVERRIDE as string;
} else {
endpoint = env.VITE_AWS_S3_ENDPOINT as string;
endpoint = env.AWS_S3_ENDPOINT as string;
}
// This code is not as clean as it could be, but it works for whats needed. Help is welcome to clean it up!