UNPKG

@cocalc/database

Version:

CoCalc: code for working with our PostgreSQL database

14 lines (12 loc) 394 B
import { join } from "path"; import { secrets } from "@cocalc/backend/data"; import { readFileSync } from "fs"; export default function dbPassword(): string | undefined { const filename = join(secrets, "postgres"); try { // fine to use sync, since reading db password happens only on startup return readFileSync(filename).toString().trim(); } catch { return undefined; } }