diff --git a/app/page.tsx b/app/page.tsx index 819b269..0d982b8 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -24,21 +24,27 @@ export default async function Home() { -
-

- Acknowledge with the Federal Government -

-
-
-

- Regions of the Federation -

-
-
-

- Receive consular services abroad -

-
+ +
+

+ Learn more about the Federal Government +

+
+ + +
+

+ Regions of the Federation +

+
+ + +
+

+ Foreign missions of Europe +

+
+
@@ -56,23 +62,29 @@ export default async function Home() {
-
-

- Acknowledge with the Federal Government -

-
+ +
+

+ Learn more about the Federal Government +

+
+
-
-

- Regions of the Federation -

-
-
-

- Receive consular services abroad -

-
+ +
+

+ Regions of the Federation +

+
+ + +
+

+ Foreign missions of Europe +

+
+
diff --git a/docker-compose.yml b/docker-compose.yml index c75d2bd..f8995b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,8 @@ services: eu: image: localhost:5000/eu:latest restart: unless-stopped + extra_hosts: + - "assets.dusiburg.ru:172.18.0.4" environment: PUBLIC_URL: ${PUBLIC_URL} DATABASE_URL: ${DATABASE_URL} @@ -13,9 +15,7 @@ services: JWT_SECRET: ${JWT_SECRET} SESSION_MAX_AGE: 604800 - - MINIO_URL: ${MINIO_URL} - MINIO_PORT: 9000 + MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} MINIO_PUBLIC_URL: ${MINIO_PUBLIC_URL} diff --git a/lib/image.ts b/lib/image.ts index a94ffdd..a9041ab 100644 --- a/lib/image.ts +++ b/lib/image.ts @@ -2,7 +2,7 @@ import crypto from "crypto"; import sharp from "sharp"; import { AppError } from "@/lib/action-result"; -import { getMinioClient, getMinioPublicClient } from "@/lib/minio"; +import { getMinioClient } from "@/lib/minio"; const BUCKET = "uploads"; const MAX_FILE_SIZE = 5 * 1024 * 1024; @@ -51,7 +51,7 @@ export async function removeImage(key: string) { } export async function getImageUrl(key: string): Promise { - return getMinioPublicClient().presignedGetObject( + return getMinioClient().presignedGetObject( BUCKET, key, 60 * 5 diff --git a/lib/minio.ts b/lib/minio.ts index 7766005..a1df8da 100644 --- a/lib/minio.ts +++ b/lib/minio.ts @@ -1,32 +1,17 @@ import { Client } from "minio"; -let _internalClient: Client | null = null; -let _publicClient: Client | null = null; +let _client: Client | null = null; export function getMinioClient(): Client { - if (!_internalClient) { - _internalClient = new Client({ - endPoint: process.env.MINIO_URL!, - port: Number(process.env.MINIO_PORT), - useSSL: false, - accessKey: process.env.MINIO_ACCESS_KEY!, - secretKey: process.env.MINIO_SECRET_KEY!, - }); - } - return _internalClient; -} - -export function getMinioPublicClient(): Client { - if (!_publicClient) { + if (!_client) { const url = new URL(process.env.MINIO_PUBLIC_URL!); - - _publicClient = new Client({ + _client = new Client({ endPoint: url.hostname, - port: url.port ? Number(url.port) : (url.protocol === "https:" ? 443 : 80), + port: url.port ? Number(url.port) : 443, useSSL: url.protocol === "https:", accessKey: process.env.MINIO_ACCESS_KEY!, secretKey: process.env.MINIO_SECRET_KEY!, }); } - return _publicClient; + return _client; } \ No newline at end of file