mirror of
https://github.com/status-im/codimd.git
synced 2025-01-12 18:54:12 +00:00
ts: lib/config/dockerSecret.js
Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
parent
3b52b19dc9
commit
10e77f34a5
@ -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
|
Loading…
x
Reference in New Issue
Block a user