mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-27 16:59:37 +02:00
Minio docker
This commit is contained in:
parent
4ed9ebc456
commit
ee32a446e9
5 changed files with 26 additions and 15 deletions
|
@ -1,7 +1,9 @@
|
||||||
DATABASE_URL=
|
DATABASE_URL=
|
||||||
|
|
||||||
MINIO_URL=http://localhost:9000
|
MINIO_SERVER_URL=http://localhost:9000
|
||||||
|
MINIO_CLIENT_URL=http://localhost:9000
|
||||||
MINIO_ENDPOINT=localhost
|
MINIO_ENDPOINT=localhost
|
||||||
MINIO_ACCESS_KEY=minioadmin
|
MINIO_ACCESS_KEY=minioadmin
|
||||||
MINIO_SECRET_KEY=minioadmin
|
MINIO_SECRET_KEY=minioadmin
|
||||||
MINIO_USE_SSL=false
|
MINIO_USE_SSL=false
|
||||||
|
BODY_SIZE_LIMIT=Infinity
|
|
@ -8,9 +8,17 @@ services:
|
||||||
# ORIGIN is only necessary when not using a reverse proxy or hosting that includes https
|
# ORIGIN is only necessary when not using a reverse proxy or hosting that includes https
|
||||||
- ORIGIN=http://localhost:3000
|
- ORIGIN=http://localhost:3000
|
||||||
- SKIP_DB_WAIT=false
|
- 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:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
- minio
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import { Client } from "minio";
|
import { Client } from "minio";
|
||||||
import { MINIO_URL } from "$env/static/private";
|
const MINIO_SERVER_URL = process.env.MINIO_SERVER_URL;
|
||||||
import { MINIO_ACCESS_KEY } from "$env/static/private";
|
const MINIO_ACCESS_KEY = process.env.MINIO_ACCESS_KEY;
|
||||||
import { MINIO_SECRET_KEY } from "$env/static/private";
|
const MINIO_SECRET_KEY = process.env.MINIO_SECRET_KEY;
|
||||||
import { MINIO_ENDPOINT } from "$env/static/private";
|
const MINIO_CLIENT_URL = process.env.MINIO_CLIENT_URL;
|
||||||
const port = MINIO_URL?.split(":").pop(); // 9000
|
const MINIO_USE_SSL = process.env.MINIO_USE_SSL;
|
||||||
|
const port = MINIO_CLIENT_URL?.split(":").pop(); // 9000
|
||||||
|
|
||||||
const minioClient = new Client({
|
const minioClient = new Client({
|
||||||
endPoint: MINIO_ENDPOINT ? MINIO_ENDPOINT : "localhost",
|
endPoint: MINIO_SERVER_URL ? MINIO_SERVER_URL : "localhost",
|
||||||
port: port ? parseInt(port) : 9000,
|
port: port ? parseInt(port) : 9000,
|
||||||
useSSL: false,
|
useSSL: MINIO_USE_SSL ? MINIO_USE_SSL === "true" : false,
|
||||||
accessKey: MINIO_ACCESS_KEY,
|
accessKey: MINIO_ACCESS_KEY as string,
|
||||||
secretKey: MINIO_SECRET_KEY,
|
secretKey: MINIO_SECRET_KEY as string,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default minioClient;
|
export default minioClient;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import minioClient from "$lib/server/minio.js";
|
import minioClient from "$lib/server/minio.js";
|
||||||
import type { RequestEvent } from "@sveltejs/kit";
|
import type { RequestEvent } from "@sveltejs/kit";
|
||||||
import { generateId } from "lucia";
|
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> {
|
export async function POST(event: RequestEvent): Promise<Response> {
|
||||||
try {
|
try {
|
||||||
|
@ -74,7 +74,7 @@ export async function POST(event: RequestEvent): Promise<Response> {
|
||||||
fileName
|
fileName
|
||||||
);
|
);
|
||||||
|
|
||||||
const publicUrl = `${MINIO_URL}/profile-pics/${fileName}`;
|
const publicUrl = `${MINIO_CLIENT_URL}/profile-pics/${fileName}`;
|
||||||
|
|
||||||
return new Response(JSON.stringify({ publicUrl }), {
|
return new Response(JSON.stringify({ publicUrl }), {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|
|
@ -14,7 +14,7 @@ const config = {
|
||||||
preprocess: vitePreprocess(),
|
preprocess: vitePreprocess(),
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter(),
|
adapter: adapter(),
|
||||||
csrf: { checkOrigin: true, }
|
csrf: { checkOrigin: true },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue