From 10e77f34a5ac8bc59ab77eed6653d6e5cb2279b2 Mon Sep 17 00:00:00 2001 From: Raccoon Date: Sat, 12 Jun 2021 07:10:14 +0800 Subject: [PATCH] ts: lib/config/dockerSecret.js Signed-off-by: Raccoon --- lib/config/{dockerSecret.js => dockerSecret.ts} | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) rename lib/config/{dockerSecret.js => dockerSecret.ts} (92%) diff --git a/lib/config/dockerSecret.js b/lib/config/dockerSecret.ts similarity index 92% rename from lib/config/dockerSecret.js rename to lib/config/dockerSecret.ts index bbac9722..593fe7a2 100644 --- a/lib/config/dockerSecret.js +++ b/lib/config/dockerSecret.ts @@ -1,18 +1,17 @@ -'use strict' - -const fs = require('fs') -const path = require('path') +import * as fs from "fs"; +import * as path from "path"; const basePath = path.resolve('/var/run/secrets/') -function getSecret (secret) { +function getSecret(secret) { const filePath = path.join(basePath, secret) if (fs.existsSync(filePath)) return fs.readFileSync(filePath) return undefined } +let dockerSecretConfig: any = {} if (fs.existsSync(basePath)) { - module.exports = { + dockerSecretConfig = { dbURL: getSecret('dburl'), // ssl path sslKeyPath: getSecret('sslkeypath'), @@ -77,3 +76,5 @@ if (fs.existsSync(basePath)) { } } } + +export = dockerSecretConfig