mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Bugfix/S3 Credentials (#4166)
only set s3 credentials when access key and secret key exist
This commit is contained in:
@@ -384,20 +384,21 @@ export const getS3Config = () => {
|
||||
throw new Error('S3 storage configuration is missing')
|
||||
}
|
||||
|
||||
let credentials: S3ClientConfig['credentials'] | undefined
|
||||
const s3Config: S3ClientConfig = {
|
||||
region: region,
|
||||
endpoint: customURL,
|
||||
forcePathStyle: forcePathStyle
|
||||
}
|
||||
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey
|
||||
s3Config.credentials = {
|
||||
accessKeyId: accessKeyId,
|
||||
secretAccessKey: secretAccessKey
|
||||
}
|
||||
}
|
||||
|
||||
const s3Client = new S3Client({
|
||||
credentials,
|
||||
region,
|
||||
endpoint: customURL,
|
||||
forcePathStyle: forcePathStyle
|
||||
})
|
||||
const s3Client = new S3Client(s3Config)
|
||||
|
||||
return { s3Client, Bucket }
|
||||
}
|
||||
|
||||
|
||||
@@ -27,14 +27,18 @@ if (USE_AWS_SECRETS_MANAGER) {
|
||||
const accessKeyId = process.env.SECRETKEY_AWS_ACCESS_KEY
|
||||
const secretAccessKey = process.env.SECRETKEY_AWS_SECRET_KEY
|
||||
|
||||
let credentials: SecretsManagerClientConfig['credentials'] | undefined
|
||||
const secretManagerConfig: SecretsManagerClientConfig = {
|
||||
region: region
|
||||
}
|
||||
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
credentials = {
|
||||
secretManagerConfig.credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey
|
||||
}
|
||||
}
|
||||
secretsManagerClient = new SecretsManagerClient({ credentials, region })
|
||||
|
||||
secretsManagerClient = new SecretsManagerClient(secretManagerConfig)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -76,14 +76,17 @@ if (USE_AWS_SECRETS_MANAGER) {
|
||||
const accessKeyId = process.env.SECRETKEY_AWS_ACCESS_KEY
|
||||
const secretAccessKey = process.env.SECRETKEY_AWS_SECRET_KEY
|
||||
|
||||
let credentials: SecretsManagerClientConfig['credentials'] | undefined
|
||||
const secretManagerConfig: SecretsManagerClientConfig = {
|
||||
region: region
|
||||
}
|
||||
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
credentials = {
|
||||
secretManagerConfig.credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey
|
||||
}
|
||||
}
|
||||
secretsManagerClient = new SecretsManagerClient({ credentials, region })
|
||||
secretsManagerClient = new SecretsManagerClient(secretManagerConfig)
|
||||
}
|
||||
|
||||
export const databaseEntities: IDatabaseEntity = {
|
||||
|
||||
@@ -25,19 +25,17 @@ if (process.env.STORAGE_TYPE === 's3') {
|
||||
throw new Error('S3 storage configuration is missing')
|
||||
}
|
||||
|
||||
let credentials: S3ClientConfig['credentials'] | undefined
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
credentials = {
|
||||
accessKeyId,
|
||||
secretAccessKey
|
||||
}
|
||||
}
|
||||
|
||||
const s3Config: S3ClientConfig = {
|
||||
region: region,
|
||||
endpoint: customURL,
|
||||
forcePathStyle: forcePathStyle,
|
||||
credentials: credentials
|
||||
forcePathStyle: forcePathStyle
|
||||
}
|
||||
|
||||
if (accessKeyId && secretAccessKey) {
|
||||
s3Config.credentials = {
|
||||
accessKeyId: accessKeyId,
|
||||
secretAccessKey: secretAccessKey
|
||||
}
|
||||
}
|
||||
|
||||
s3ServerStream = new S3StreamLogger({
|
||||
|
||||
Reference in New Issue
Block a user