From 530f59443381e7ca490918eda1d89fcb0af960fe Mon Sep 17 00:00:00 2001 From: xion Date: Thu, 27 Mar 2025 11:52:16 +0800 Subject: [PATCH] clear --- package.json | 2 +- src/modules/minio.ts | 32 ++++++++++++++++---------------- submodules/code-center-module | 1 + 3 files changed, 18 insertions(+), 17 deletions(-) create mode 160000 submodules/code-center-module diff --git a/package.json b/package.json index f442ea8..9189933 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "start": "pm2 start dist/app.mjs --name codecenter", "release": "node ./config/release/index.mjs", "pub": "envision pack -p -u", - "ssh": "ssh -L 6379:localhost:6379 -L 5432:localhost:5432 light ", + "ssh": "ssh -L 6379:localhost:6379 -L 5432:localhost:5432 -L 9000:localhost:9000 light ", "ssh:sky": "ssh -L 6379:172.21.32.13:6379 sky", "dev:lib": "turbo run dev:lib", "build:lib": "turbo run build", diff --git a/src/modules/minio.ts b/src/modules/minio.ts index a648051..4c26368 100644 --- a/src/modules/minio.ts +++ b/src/modules/minio.ts @@ -1,25 +1,25 @@ import { Client, ClientOptions } from 'minio'; - +import { config } from './config.ts'; const minioConfig = { - endPoint: process.env.MINIO_ENDPOINT || 'localhost', - port: parseInt(process.env.MINIO_PORT || '9000'), - useSSL: process.env.MINIO_USE_SSL === 'true', - accessKey: process.env.MINIO_ACCESS_KEY, - secretKey: process.env.MINIO_SECRET_KEY, + endPoint: config.MINIO_ENDPOINT || 'localhost', + port: parseInt(config.MINIO_PORT || '9000'), + useSSL: config.MINIO_USE_SSL === 'true', + accessKey: config.MINIO_ACCESS_KEY, + secretKey: config.MINIO_SECRET_KEY, }; export const minioClient = new Client(minioConfig); -export const bucketName = process.env.MINIO_BUCKET_NAME || 'resources'; +export const bucketName = config.MINIO_BUCKET_NAME || 'resources'; if (!minioClient) { throw new Error('Minio client not initialized'); } // 验证权限 -// (async () => { -// const bucketExists = await minioClient.bucketExists(bucketName); -// if (!bucketExists) { -// await minioClient.makeBucket(bucketName); -// } -// const res = await minioClient.putObject(bucketName, 'private/test/a.b', 'test'); -// console.log('minio putObject', res); - -// })(); +(async () => { + const bucketExists = await minioClient.bucketExists(bucketName); + if (!bucketExists) { + await minioClient.makeBucket(bucketName); + } + console.log('bucketExists', bucketExists); + // const res = await minioClient.putObject(bucketName, 'root/test/0.0.1/a.txt', 'test'); + // console.log('minio putObject', res); +})(); diff --git a/submodules/code-center-module b/submodules/code-center-module new file mode 160000 index 0000000..0f0a4cb --- /dev/null +++ b/submodules/code-center-module @@ -0,0 +1 @@ +Subproject commit 0f0a4cbd6a413b9c94b741c27f7f94803d47b708