Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
fix secrets.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCactus committed Aug 19, 2022
1 parent 051a43a commit a629aaf
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/libs/secret.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import fs from 'fs'
import fs from 'fs';

export function readSecret(secretName) {
try {
const path = process.env.SECRET_PATH || `/run/secrets/${secretName}`
return fs.readFileSync(path, 'utf8')
} catch (err) {
if (err.code !== 'ENOENT') {
console.error(
`An error occurred while trying to read the secret path: ${path}. Err: ${err}`
)
} else {
console.debug(`Could not find the secret,: ${secretName}. Err: ${err}`)
}
return ''
}
const path = process.env.SECRET_PATH || `/run/secrets/${secretName}`;
try {
return fs.readFileSync(path, 'utf8');
} catch (err) {
if (err.code !== 'ENOENT') {
console.error(
`An error occurred while trying to read the secret path: ${path}. Err: ${err}`,
);
} else {
console.debug(`Could not find the secret,: ${secretName}. Err: ${err}`);
}
return '';
}
}

0 comments on commit a629aaf

Please sign in to comment.