Feat/add s3 custom url (#2891)

add s3 custom url
This commit is contained in:
Henry Heng 2024-07-26 15:39:24 +01:00 committed by GitHub
parent 2dadf2e42b
commit 1c730323e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 4 deletions

View File

@ -155,6 +155,7 @@ Flowise support different environment variables to configure your instance. You
| S3_STORAGE_ACCESS_KEY_ID | AWS Access Key | String | |
| S3_STORAGE_SECRET_ACCESS_KEY | AWS Secret Key | String | |
| S3_STORAGE_REGION | Region for S3 bucket | String | |
| S3_ENDPOINT_URL | Custom Endpoint for S3 | String | |
You can also specify the env variables when using `npx`. For example:

View File

@ -46,4 +46,5 @@ BLOB_STORAGE_PATH=/root/.flowise/storage
# S3_STORAGE_BUCKET_NAME=flowise
# S3_STORAGE_ACCESS_KEY_ID=<your-access-key>
# S3_STORAGE_SECRET_ACCESS_KEY=<your-secret-key>
# S3_STORAGE_REGION=us-west-2
# S3_STORAGE_REGION=us-west-2
# S3_ENDPOINT_URL=<custom-s3-endpoint-url>

View File

@ -148,6 +148,7 @@ Flowise 支持不同的环境变量来配置您的实例。您可以在 `package
| S3_STORAGE_ACCESS_KEY_ID | AWS 访问密钥 (Access Key) | 字符串 | |
| S3_STORAGE_SECRET_ACCESS_KEY | AWS 密钥 (Secret Key) | 字符串 | |
| S3_STORAGE_REGION | S3 存储地区 | 字符串 | |
| S3_ENDPOINT_URL | S3 端点 URL | 字符串 | |
您也可以在使用 `npx` 时指定环境变量。例如:

View File

@ -318,6 +318,8 @@ export const getS3Config = () => {
const secretAccessKey = process.env.S3_STORAGE_SECRET_ACCESS_KEY
const region = process.env.S3_STORAGE_REGION
const Bucket = process.env.S3_STORAGE_BUCKET_NAME
const customURL = process.env.S3_ENDPOINT_URL
if (!region || !Bucket) {
throw new Error('S3 storage configuration is missing')
}
@ -332,7 +334,8 @@ export const getS3Config = () => {
const s3Client = new S3Client({
credentials,
region
region,
endpoint: customURL
})
return { s3Client, Bucket }
}

View File

@ -46,4 +46,5 @@ PORT=3000
# S3_STORAGE_BUCKET_NAME=flowise
# S3_STORAGE_ACCESS_KEY_ID=<your-access-key>
# S3_STORAGE_SECRET_ACCESS_KEY=<your-secret-key>
# S3_STORAGE_REGION=us-west-2
# S3_STORAGE_REGION=us-west-2
# S3_ENDPOINT_URL=<custom-s3-endpoint-url>

View File

@ -52,7 +52,8 @@ export default class Start extends Command {
S3_STORAGE_BUCKET_NAME: Flags.string(),
S3_STORAGE_ACCESS_KEY_ID: Flags.string(),
S3_STORAGE_SECRET_ACCESS_KEY: Flags.string(),
S3_STORAGE_REGION: Flags.string()
S3_STORAGE_REGION: Flags.string(),
S3_ENDPOINT_URL: Flags.string()
}
async stopProcess() {
@ -146,6 +147,7 @@ export default class Start extends Command {
if (flags.S3_STORAGE_ACCESS_KEY_ID) process.env.S3_STORAGE_ACCESS_KEY_ID = flags.S3_STORAGE_ACCESS_KEY_ID
if (flags.S3_STORAGE_SECRET_ACCESS_KEY) process.env.S3_STORAGE_SECRET_ACCESS_KEY = flags.S3_STORAGE_SECRET_ACCESS_KEY
if (flags.S3_STORAGE_REGION) process.env.S3_STORAGE_REGION = flags.S3_STORAGE_REGION
if (flags.S3_ENDPOINT_URL) process.env.S3_ENDPOINT_URL = flags.S3_ENDPOINT_URL
await (async () => {
try {