summary refs log tree commit diff
path: root/src/util/secretUtils.js
blob: 7394395ec917f84f468c2f3acc3c59f4231e32ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import fs from 'node:fs/promises';

export async function readSecret(name, path) {
    console.log(`[SECRET] Reading secret "${name}" from path: ${path}`);
    if (!path) {
        throw new Error(`Path to secret file is required: ${name}`);
    }
    const content = await fs.readFile(path, 'utf8');
    return content.trim();
}