From 4431c33162d92cb89147b332e224cbba17fbf698 Mon Sep 17 00:00:00 2001 From: Jarrett Cruger Date: Tue, 2 Feb 2016 16:38:48 -0800 Subject: [PATCH] [fix] handle buffers so we dont get ambiguous errors when we dont strictly read the file as utf8 --- lib/nconf/stores/file.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nconf/stores/file.js b/lib/nconf/stores/file.js index 5761b0a..0aef8e6 100644 --- a/lib/nconf/stores/file.js +++ b/lib/nconf/stores/file.js @@ -38,8 +38,8 @@ var File = exports.File = function (options) { || 2; if (this.secure) { - this.secure = typeof this.secure === 'string' - ? { secret: this.secure } + this.secure = Buffer.isBuffer(this.secure) || typeof this.secure === 'string' + ? { secret: this.secure.toString() } : this.secure; this.secure.alg = this.secure.alg || 'aes-256-ctr';