From 60827ee90fd7c4af1d189d640209084d81545f84 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Wed, 22 Jan 2020 20:50:07 -0600 Subject: [PATCH] Added rclone encryption support --- README.md | 9 +++++---- assets/common.sh | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 612bed7..2a1d9a7 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,16 @@ resource_types: source: repository: warricksothr/concourse-rclone-resource tag: latest + files: + serviceAccountFile: | + ...contents... ``` ## Source Configuration * `config`: Required. The rclone config file contents to use. -* `files`: Optional. Additional files to write to the /tmp directory. This is a map of key/value pairs for the filename and contents of that file +* `password`: Optional. Encryption password used for encrypted rclone configurations. Please use secrets management for this value. +* `files`: Optional. Additional files to write to the /tmp directory. This is a map of key/value pairs for the filename and contents of that file. ### Example @@ -37,9 +41,6 @@ resources: root_folder_id = service_account_file = /tmp/serviceAccountFile token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2014-03-16T13:57:58.955387075Z"} - files: - serviceAccountFile: | - ...contents... ``` ### Note diff --git a/assets/common.sh b/assets/common.sh index fa4049e..064fe9b 100644 --- a/assets/common.sh +++ b/assets/common.sh @@ -7,6 +7,12 @@ load_config() { local rclone_config_file=$rclone_config_path/.rclone.conf (jq -r '.source.config // empty' < "$1") > "$config_path" + config_pass=$('.source.password // ""' < "$1") + + if [[ -n "${config_pass}" ]]; then + RCLONE_CONFIG_PASS="${config_pass}" + export RCLONE_CONFIG_PASS + fi if [ -s "$config_path" ]; then mkdir -p $rclone_config_path