From 6ef2f974ae45e6bc0f0eb6f76450b1d6bb9d0009 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 8 May 2017 16:03:29 -0700 Subject: [PATCH] fs: Use key to determine backup extension --- src/storage/filesystem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 74586780a..3c50e5973 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -24,7 +24,6 @@ var assert = require('assert'), targz = require('./targz.js'); var FALLBACK_BACKUP_FOLDER = '/var/backups'; -var FILE_TYPE = '.tar.gz.enc'; var BACKUP_USER = config.TEST ? process.env.USER : 'yellowtent'; // internal only @@ -32,6 +31,8 @@ function getBackupFilePath(apiConfig, backupId) { assert.strictEqual(typeof apiConfig, 'object'); assert.strictEqual(typeof backupId, 'string'); + const FILE_TYPE = apiConfig.key ? '.tar.gz.enc' : '.tar.gz'; + return path.join(apiConfig.backupFolder || FALLBACK_BACKUP_FOLDER, backupId.endsWith(FILE_TYPE) ? backupId : backupId+FILE_TYPE); }