From 7be0489542229bf5d2e202950720dbdb2b7403c9 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 9 Nov 2023 00:06:07 +0800 Subject: [PATCH] feat: add env MINIO_SSL #172 --- server/packages/sdk/src/services/lib/settings.ts | 1 + server/services/core/file.service.ts | 2 +- website/docs/deployment/environment.md | 1 + .../current/deployment/environment.md | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/packages/sdk/src/services/lib/settings.ts b/server/packages/sdk/src/services/lib/settings.ts index 4088208c..a564e0bd 100644 --- a/server/packages/sdk/src/services/lib/settings.ts +++ b/server/packages/sdk/src/services/lib/settings.ts @@ -27,6 +27,7 @@ export const config = { storage: { type: 'minio', // 可选: minio minioUrl: process.env.MINIO_URL, + ssl: checkEnvTrusty(process.env.MINIO_SSL) ?? false, user: process.env.MINIO_USER, pass: process.env.MINIO_PASS, bucketName: process.env.MINIO_BUCKET_NAME || 'tailchat', diff --git a/server/services/core/file.service.ts b/server/services/core/file.service.ts index 7f22ff89..3c939f14 100644 --- a/server/services/core/file.service.ts +++ b/server/services/core/file.service.ts @@ -41,7 +41,7 @@ class FileService extends TcService { // https://github.com/designtesbrot/moleculer-minio#settings this.registerSetting('endPoint', endPoint); this.registerSetting('port', Number(port)); - this.registerSetting('useSSL', false); + this.registerSetting('useSSL', config.storage.ssl); this.registerSetting('accessKey', config.storage.user); this.registerSetting('secretKey', config.storage.pass); this.registerSetting('pathStyle', config.storage.pathStyle); diff --git a/website/docs/deployment/environment.md b/website/docs/deployment/environment.md index cff0461a..446c6f3f 100644 --- a/website/docs/deployment/environment.md +++ b/website/docs/deployment/environment.md @@ -19,6 +19,7 @@ title: Environment Variable | MINIO_PASS | - | File service password | | MINIO_BUCKET_NAME | tailchat | file service bucket name | | MINIO_PATH_STYLE | false | Whether to use path-style s3 communication format, `true` is `Path Style`, `false` is `Virtual hosted style` | +| MINIO_SSL | false | Whether to use SSL to connect storage, if "1" or "true" enable SSL | | SMTP_SENDER | - | Mail service sender (example: `"Tailchat" example@163.com`) | | SMTP_URI | - | mail service connection address (example: `smtp://username:password@smtp.example.com/?pool=true`) | | FILE_LIMIT | 1048576 | File/image upload size limit, the default is 1m, please enter a number(unit: byte) | diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md index 55b08089..21de2e43 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md @@ -19,6 +19,7 @@ title: 环境变量 | MINIO_PASS | - | 文件服务密码 | | MINIO_BUCKET_NAME | tailchat | 文件服务存储桶名 | | MINIO_PATH_STYLE | "Path" | 是否使用路径形式的s3通信格式, `Path` 为 `Path Style`, `VirtualHosted` 为 `Virtual hosted style` | +| MINIO_SSL | false | 是否使用加密连接文件存储服务, 如果为 "1" 或者 "true" 则使用SSL协议 | | SMTP_SENDER | - | 邮件服务发件人(示例: `"Tailchat" example@163.com`) | | SMTP_URI | - | 邮件服务连接地址(示例: `smtp://username:password@smtp.example.com/?pool=true`) | | FILE_LIMIT | 1048576 | 文件/图片上传的大小限制,默认为1m,请输入数字,(单位: 字节) |