diff --git a/constant/__init__.py b/constant/__init__.py index 16857d3..2ee3d22 100644 --- a/constant/__init__.py +++ b/constant/__init__.py @@ -6,4 +6,4 @@ SUPPORT_FEATURE = ( 'rclone_upload', 'custom_re_encode', ) -SOFTWARE_VERSION = '0.0.6' +SOFTWARE_VERSION = '0.0.8' diff --git a/util/oss.py b/util/oss.py index d3832c6..05b3866 100644 --- a/util/oss.py +++ b/util/oss.py @@ -27,6 +27,10 @@ def upload_to_oss(url, file_path): if os.getenv("UPLOAD_METHOD") == "rclone": with tracer.start_as_current_span("rclone_to_oss") as r_span: replace_map = os.getenv("RCLONE_REPLACE_MAP") + config_file = os.getenv("RCLONE_CONFIG_FILE") + rclone_config = "" + if config_file != "": + rclone_config = f"--config {config_file}" r_span.set_attribute("rclone.replace_map", replace_map) if replace_map != "": replace_list = [i.split("|", 1) for i in replace_map.split(",")] @@ -36,7 +40,7 @@ def upload_to_oss(url, file_path): new_url = new_url.split("?", 1)[0] r_span.set_attribute("rclone.target_dir", new_url) if new_url != url: - result = os.system(f"rclone copyto --no-check-dest --ignore-existing --multi-thread-chunk-size 8M --multi-thread-streams 8 {file_path} {new_url}") + result = os.system(f"rclone copyto --no-check-dest --ignore-existing --multi-thread-chunk-size 8M --multi-thread-streams 8 {rclone_config} {file_path} {new_url}") r_span.set_attribute("rclone.result", result) if result == 0: span.set_status(Status(StatusCode.OK))