mirror of
https://github.com/Ellpeck/WoodpeckerPlugins.git
synced 2024-11-22 02:23:29 +01:00
improved some phrasing and defaults, fixed chunk size environment variable
This commit is contained in:
parent
9472407096
commit
c64475325b
2 changed files with 4 additions and 4 deletions
|
@ -14,6 +14,6 @@ steps:
|
||||||
- "**/*.md"
|
- "**/*.md"
|
||||||
dest: Uploads/CoolMarkdownFiles # the destination directory
|
dest: Uploads/CoolMarkdownFiles # the destination directory
|
||||||
basedir: "." # optional, local base directory for files, defaults to .
|
basedir: "." # optional, local base directory for files, defaults to .
|
||||||
chunksize: # optional, chunk size in bytes, defaults to 52428800
|
chunksize: # optional, chunk size in bytes, defaults to 10485760, or 10 MiB
|
||||||
quiet: false # optional, whether to reduce output
|
quiet: false # optional, whether to reduce output
|
||||||
```
|
```
|
||||||
|
|
|
@ -20,7 +20,7 @@ if (!destEnv)
|
||||||
throw "Missing required arg dest";
|
throw "Missing required arg dest";
|
||||||
|
|
||||||
const baseDir = process.env.PLUGIN_BASEDIR || ".";
|
const baseDir = process.env.PLUGIN_BASEDIR || ".";
|
||||||
const chunkSizeEnv = process.env.PLUGIN_CHUNKSIZE || 50 * 1024 * 1024;
|
const chunkSizeEnv = process.env.PLUGIN_CHUNKSIZE || 10 * 1024 * 1024;
|
||||||
const quiet = process.env.PLUGIN_QUIET || false;
|
const quiet = process.env.PLUGIN_QUIET || false;
|
||||||
|
|
||||||
upload();
|
upload();
|
||||||
|
@ -31,7 +31,7 @@ async function upload() {
|
||||||
for (let pattern of filesEnv.split(",")) {
|
for (let pattern of filesEnv.split(",")) {
|
||||||
let files = await glob.glob(pattern, { cwd: baseDir });
|
let files = await glob.glob(pattern, { cwd: baseDir });
|
||||||
if (!files.length)
|
if (!files.length)
|
||||||
console.log("No files to upload");
|
console.log(`No files found for pattern ${pattern}`);
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
let dest = `${destEnv}/${file}`;
|
let dest = `${destEnv}/${file}`;
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
@ -59,7 +59,7 @@ async function upload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// use lib to upload file
|
// use lib to upload file
|
||||||
await upload.uploadFile(`${baseDir}/${file}`, dest, chunkSizeEnv).then(e => {
|
await upload.uploadFile(`${baseDir}/${file}`, dest, parseInt(chunkSizeEnv)).then(e => {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
console.log(`Uploaded ${file} to ${dest} (${e})`);
|
console.log(`Uploaded ${file} to ${dest} (${e})`);
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|
Loading…
Reference in a new issue