Update parameters

This commit is contained in:
Yunxiao Xu
2025-09-11 16:07:03 -07:00
parent c843a58ca8
commit ed1027e5c9
2 changed files with 18 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ module.exports = async function(args) {
aws_cli_profile, aws_cli_profile,
headers, headers,
delete_removed, delete_removed,
force_path_style,
endpoint, endpoint,
access_key_id, access_key_id,
secret_access_key, secret_access_key,
@@ -27,7 +28,7 @@ module.exports = async function(args) {
aws_secret aws_secret
} = args; } = args;
if (!bucket || !endpoint) { if (!bucket) {
log.error('Bucket and Endpoint must be configured in _config.yml'); log.error('Bucket and Endpoint must be configured in _config.yml');
log.info(chalk.bold('--- Generic S3-Compatible Service Example (like Teby, MinIO, Cloudflare R2) ---')); log.info(chalk.bold('--- Generic S3-Compatible Service Example (like Teby, MinIO, Cloudflare R2) ---'));
log.info(' deploy:'); log.info(' deploy:');
@@ -40,6 +41,7 @@ module.exports = async function(args) {
log.info(' [prefix]: <prefix>'); log.info(' [prefix]: <prefix>');
log.info(' [concurrency]: 20'); log.info(' [concurrency]: 20');
log.info(' [delete_removed]: true'); log.info(' [delete_removed]: true');
log.info(' [force_path_style]: true');
log.info(''); log.info('');
log.info(chalk.bold('--- AWS S3 Example ---')); log.info(chalk.bold('--- AWS S3 Example ---'));
log.info(' deploy:'); log.info(' deploy:');
@@ -53,10 +55,20 @@ module.exports = async function(args) {
return; return;
} }
const filledRegion = region || 'us-east-1';
const filledEndpoint = endpoint || `https://s3.${filledRegion}.amazonaws.com`;
if (!region) {
log.warn('No region specified. Using default region: us-east-1');
}
if (!endpoint) {
log.warn(`No endpoint specified. Using default AWS S3 endpoint: ${filledEndpoint}`);
}
// --- 2. 创建 S3 客户端 --- // --- 2. 创建 S3 客户端 ---
const s3Config = { const s3Config = {
region: region || 'us-east-1', region: filledRegion,
endpoint: endpoint, endpoint: filledEndpoint,
forcePathStyle: force_path_style !== false, // 默认为 true
}; };
const keyId = access_key_id || aws_key; const keyId = access_key_id || aws_key;

View File

@@ -9,7 +9,7 @@
"aws", "aws",
"deployer" "deployer"
], ],
"author": "tianjincai <tianjincai@hotmail.com>", "author": "Yunxiao Xu <xuyunxiao2001@gmail.com>",
"contributors": [ "contributors": [
{ {
"name": "tianjincai", "name": "tianjincai",
@@ -18,10 +18,10 @@
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/JackTJC/hexo-deployer-s3-plus.git" "url": "git+https://git.yunxiao.xyz/YunxiaoXu/hexo-deployer-s3-plus.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/JackTJC/hexo-deployer-s3-plus/issues" "url": "https://git.yunxiao.xyz/YunxiaoXu/hexo-deployer-s3-plus/issues"
}, },
"license": { "license": {
"type": "MIT" "type": "MIT"