fix(s3): Add requestChecksumCalculation config option

Closes #1619
This commit is contained in:
Maksim Eltyshev
2026-04-01 22:12:58 +02:00
parent 9abad91b04
commit dbad8e976b
5 changed files with 12 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ services:
# - S3_SECRET_ACCESS_KEY=
# - S3_BUCKET=
# - S3_FORCE_PATH_STYLE=true
# - S3_REQUEST_CHECKSUM_CALCULATION=
# - OIDC_ISSUER=
# - OIDC_CLIENT_ID=

View File

@@ -76,6 +76,7 @@ services:
# - S3_SECRET_ACCESS_KEY__FILE=/run/secrets/s3_secret_access_key
# - S3_BUCKET=
# - S3_FORCE_PATH_STYLE=true
# - S3_REQUEST_CHECKSUM_CALCULATION=
# - OIDC_ISSUER=
# - OIDC_CLIENT_ID=

View File

@@ -51,6 +51,7 @@ SECRET_KEY=notsecretkey
# S3_SECRET_ACCESS_KEY=
# S3_BUCKET=
# S3_FORCE_PATH_STYLE=true
# S3_REQUEST_CHECKSUM_CALCULATION=
# OIDC_ISSUER=
# OIDC_CLIENT_ID=

View File

@@ -29,7 +29,7 @@ module.exports = function defineS3Hook(sails) {
sails.log.info('Initializing custom hook (`s3`)');
client = new S3Client({
const config = {
endpoint: sails.config.custom.s3Endpoint,
region: sails.config.custom.s3Region || 'eu-central-1',
credentials: {
@@ -37,7 +37,13 @@ module.exports = function defineS3Hook(sails) {
secretAccessKey: sails.config.custom.s3SecretAccessKey,
},
forcePathStyle: sails.config.custom.s3ForcePathStyle,
});
};
if (sails.config.custom.s3RequestChecksumCalculation) {
config.requestChecksumCalculation = sails.config.custom.s3RequestChecksumCalculation;
}
client = new S3Client(config);
},
getClient() {

View File

@@ -72,6 +72,7 @@ module.exports.custom = {
s3SecretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
s3Bucket: process.env.S3_BUCKET,
s3ForcePathStyle: process.env.S3_FORCE_PATH_STYLE === 'true',
s3RequestChecksumCalculation: process.env.S3_REQUEST_CHECKSUM_CALCULATION,
oidcIssuer: process.env.OIDC_ISSUER,
oidcClientId: process.env.OIDC_CLIENT_ID,