File tree Expand file tree Collapse file tree
plugins/redc-plugin-upload-r2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{{- /* upload-r2: upload config file to Cloudflare R2 via rclone */ -}}
22{{- $filename := .Config.filename | default (.Vars.filename | default " default-config.yaml" ) -}}
3- {{- $bucketName := .Config.bucket_name | default (.Vars.buckets_name | default " test " ) -}}
3+ {{- $bucketName := .Config.bucket_name | default (.Vars.buckets_name | default " " ) -}}
44{{- $bucketPath := .Config.bucket_path | default (.Vars.buckets_path | default " " ) -}}
5+ {{- if eq $bucketName " " -}}
6+ {{- else -}}
57{{- $bucketPath = trimSpace $bucketPath -}}
68{{- $filePath := printf " %s /%s " .CasePath $filename -}}
79{{- $remotePath := printf " r2:%s /" $bucketName -}}
810{{- if ne $bucketPath " " -}}
911{{- $remotePath = printf " r2:%s /%s /" $bucketName $bucketPath -}}
1012{{- end -}}
11- {{- /* Delete old file (ignore errors) */ -}}
1213{{- exec " rclone" " deletefile" (printf " %s%s " $remotePath $filename ) -}}
13- {{- /* Upload */ -}}
1414{{- exec " rclone" " copy" $filePath $remotePath -}}
1515{{- setOutput " r2_path" (printf " %s%s " $remotePath $filename ) -}}
16+ {{- end -}}
Original file line number Diff line number Diff line change 2020 "config_schema" : {
2121 "bucket_name" : {
2222 "type" : " string" ,
23- "required" : false ,
24- "description" : " R2 存储桶名称 (默认从 tfvars 读取 buckets_name,兜底 test) " ,
25- "default" : " test "
23+ "required" : true ,
24+ "description" : " R2 存储桶名称" ,
25+ "default" : " "
2626 },
2727 "bucket_path" : {
2828 "type" : " string" ,
29- "required" : false ,
30- "description" : " R2 存储桶内路径 (默认从 tfvars 读取 buckets_path) " ,
29+ "required" : true ,
30+ "description" : " R2 存储桶内路径" ,
3131 "default" : " "
3232 },
3333 "filename" : {
You can’t perform that action at this time.
0 commit comments