From ebc0b27bf9ba1ffdb7d39818be09a9f743de5531 Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Wed, 26 Dec 2018 00:01:12 -0500 Subject: [PATCH] Allow overriding of directory using SECRETS_DIR env var --- README.md | 5 +++++ index.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b50d650..745f5e3 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,8 @@ npm install @cloudreach/docker-secrets const secrets = require('@cloudreach/docker-secrets'); console.log(secrets); ``` + +## Customization + +If the `SECRETS_DIR` environment variable is set, the specified location will be used in stead of `/run/secrets`. + diff --git a/index.js b/index.js index 2d100ee..8b29c71 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); -const SECRETS_DIR = '/run/secrets'; +const SECRETS_DIR = process.env.SECRETS_DIR || '/run/secrets'; const output = {}; if (fs.existsSync(SECRETS_DIR)) {