1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-24 15:29:36 +02:00

Minio docker

This commit is contained in:
Sean Morley 2024-06-09 18:42:32 +00:00
parent 4ed9ebc456
commit ee32a446e9
5 changed files with 26 additions and 15 deletions

View file

@ -1,7 +1,9 @@
DATABASE_URL=
MINIO_URL=http://localhost:9000
MINIO_SERVER_URL=http://localhost:9000
MINIO_CLIENT_URL=http://localhost:9000
MINIO_ENDPOINT=localhost
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_USE_SSL=false
MINIO_USE_SSL=false
BODY_SIZE_LIMIT=Infinity

View file

@ -8,9 +8,17 @@ services:
# ORIGIN is only necessary when not using a reverse proxy or hosting that includes https
- ORIGIN=http://localhost:3000
- SKIP_DB_WAIT=false
# Only necessary for externaly hosted databases such as NeonDB
- MINIO_SERVER_URL=minio
- MINIO_CLIENT_URL=http://localhost:9000
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
- MINIO_USE_SSL=false
- BODY_SIZE_LIMIT=Infinity
# Only necessary for externally hosted databases such as NeonDB
depends_on:
- db
- minio
db:
image: postgres
environment:

View file

@ -1,16 +1,17 @@
import { Client } from "minio";
import { MINIO_URL } from "$env/static/private";
import { MINIO_ACCESS_KEY } from "$env/static/private";
import { MINIO_SECRET_KEY } from "$env/static/private";
import { MINIO_ENDPOINT } from "$env/static/private";
const port = MINIO_URL?.split(":").pop(); // 9000
const MINIO_SERVER_URL = process.env.MINIO_SERVER_URL;
const MINIO_ACCESS_KEY = process.env.MINIO_ACCESS_KEY;
const MINIO_SECRET_KEY = process.env.MINIO_SECRET_KEY;
const MINIO_CLIENT_URL = process.env.MINIO_CLIENT_URL;
const MINIO_USE_SSL = process.env.MINIO_USE_SSL;
const port = MINIO_CLIENT_URL?.split(":").pop(); // 9000
const minioClient = new Client({
endPoint: MINIO_ENDPOINT ? MINIO_ENDPOINT : "localhost",
endPoint: MINIO_SERVER_URL ? MINIO_SERVER_URL : "localhost",
port: port ? parseInt(port) : 9000,
useSSL: false,
accessKey: MINIO_ACCESS_KEY,
secretKey: MINIO_SECRET_KEY,
useSSL: MINIO_USE_SSL ? MINIO_USE_SSL === "true" : false,
accessKey: MINIO_ACCESS_KEY as string,
secretKey: MINIO_SECRET_KEY as string,
});
export default minioClient;

View file

@ -3,7 +3,7 @@
import minioClient from "$lib/server/minio.js";
import type { RequestEvent } from "@sveltejs/kit";
import { generateId } from "lucia";
import { MINIO_URL } from "$env/static/private";
const MINIO_CLIENT_URL = process.env.MINIO_CLIENT_URL;
export async function POST(event: RequestEvent): Promise<Response> {
try {
@ -74,7 +74,7 @@ export async function POST(event: RequestEvent): Promise<Response> {
fileName
);
const publicUrl = `${MINIO_URL}/profile-pics/${fileName}`;
const publicUrl = `${MINIO_CLIENT_URL}/profile-pics/${fileName}`;
return new Response(JSON.stringify({ publicUrl }), {
status: 200,

View file

@ -14,7 +14,7 @@ const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
csrf: { checkOrigin: true, }
csrf: { checkOrigin: true },
},
};