From ed1027e5c97bbeb881940fda724631a7250968cb Mon Sep 17 00:00:00 2001 From: Yunxiao Xu Date: Thu, 11 Sep 2025 16:07:03 -0700 Subject: [PATCH] Update parameters --- lib/deployer.js | 18 +++++++++++++++--- package.json | 6 +++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/deployer.js b/lib/deployer.js index ff88883..d24fc39 100644 --- a/lib/deployer.js +++ b/lib/deployer.js @@ -20,6 +20,7 @@ module.exports = async function(args) { aws_cli_profile, headers, delete_removed, + force_path_style, endpoint, access_key_id, secret_access_key, @@ -27,7 +28,7 @@ module.exports = async function(args) { aws_secret } = args; - if (!bucket || !endpoint) { + if (!bucket) { 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(' deploy:'); @@ -40,6 +41,7 @@ module.exports = async function(args) { log.info(' [prefix]: '); log.info(' [concurrency]: 20'); log.info(' [delete_removed]: true'); + log.info(' [force_path_style]: true'); log.info(''); log.info(chalk.bold('--- AWS S3 Example ---')); log.info(' deploy:'); @@ -53,10 +55,20 @@ module.exports = async function(args) { 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 客户端 --- const s3Config = { - region: region || 'us-east-1', - endpoint: endpoint, + region: filledRegion, + endpoint: filledEndpoint, + forcePathStyle: force_path_style !== false, // 默认为 true }; const keyId = access_key_id || aws_key; diff --git a/package.json b/package.json index 2f4760d..7dee274 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "aws", "deployer" ], - "author": "tianjincai ", + "author": "Yunxiao Xu ", "contributors": [ { "name": "tianjincai", @@ -18,10 +18,10 @@ ], "repository": { "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": { - "url": "https://github.com/JackTJC/hexo-deployer-s3-plus/issues" + "url": "https://git.yunxiao.xyz/YunxiaoXu/hexo-deployer-s3-plus/issues" }, "license": { "type": "MIT"