diff --git a/.env.example b/.env.example index 3f8841b..127f3df 100644 --- a/.env.example +++ b/.env.example @@ -5,5 +5,5 @@ DATABASE_URL= AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= -VITE_AWS_S3_ENDPOINT= +AWS_S3_ENDPOINT= AWS_REGION= \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6a5305a..f7fc16e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/src/lib/server/s3.ts b/src/lib/server/s3.ts index 2349d46..bc549b8 100644 --- a/src/lib/server/s3.ts +++ b/src/lib/server/s3.ts @@ -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!